jekyll-theme-gaeblogx 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +9 -0
  4. data/_includes/algolia.html +75 -0
  5. data/_includes/backToTop.html +5 -0
  6. data/_includes/category.html +19 -0
  7. data/_includes/comments.html +46 -0
  8. data/_includes/footer.html +33 -0
  9. data/_includes/head.html +58 -0
  10. data/_includes/header.html +34 -0
  11. data/_includes/previousAndNext.html +13 -0
  12. data/_includes/sidebar-search.html +25 -0
  13. data/_includes/tag.html +16 -0
  14. data/_layouts/default.html +26 -0
  15. data/_layouts/demo.html +10 -0
  16. data/_layouts/page.html +31 -0
  17. data/_layouts/post.html +107 -0
  18. data/_sass/_backToTop.scss +49 -0
  19. data/_sass/_demo.scss +65 -0
  20. data/_sass/_footer.scss +63 -0
  21. data/_sass/_header.scss +174 -0
  22. data/_sass/_index.scss +174 -0
  23. data/_sass/_layout.scss +242 -0
  24. data/_sass/_page.scss +238 -0
  25. data/_sass/_post-old.scss +109 -0
  26. data/_sass/_post.scss +83 -0
  27. data/_sass/_reset.scss +119 -0
  28. data/_sass/_scrollbar.scss +35 -0
  29. data/_sass/_syntax-highlighting.scss +99 -0
  30. data/assets/10.jpg +0 -0
  31. data/assets/AWS-Introduction-ec2.png +0 -0
  32. data/assets/Cache-Oblivious-Algorithms-FunnelSort.jpg +0 -0
  33. data/assets/Condition-Variables-fig1.png +0 -0
  34. data/assets/Dynamic-Compilation-adaptJVM.pdf +0 -0
  35. data/assets/Dynamic-Compilation-dyncomp.pdf +0 -0
  36. data/assets/Fibonacci-Heap-Fig3.png +0 -0
  37. data/assets/Fibonacci-Heap-Fig5.png +0 -0
  38. data/assets/Fibonacci-Heap-Fig6.png +0 -0
  39. data/assets/Fibonacci-Heap-Fig7.png +0 -0
  40. data/assets/File-System-bc.jpg +0 -0
  41. data/assets/File-System-filetable.rich.jpg +0 -0
  42. data/assets/GIL-Battle.png +0 -0
  43. data/assets/GIL-CPU.png +0 -0
  44. data/assets/GIL-Check.png +0 -0
  45. data/assets/GIL-IO.png +0 -0
  46. data/assets/GIL-Measure-1.png +0 -0
  47. data/assets/GIL-Measure-2.png +0 -0
  48. data/assets/GIL-Signal.png +0 -0
  49. data/assets/GIL-Tick.png +0 -0
  50. data/assets/Garbage-Collection-Slides-gc.pdf +0 -0
  51. data/assets/Garbage-Collection-copying-1.png +0 -0
  52. data/assets/Garbage-Collection-copying-2.png +0 -0
  53. data/assets/Garbage-Collection-free-list.png +0 -0
  54. data/assets/Garbage-Collection-generation-1.png +0 -0
  55. data/assets/Garbage-Collection-mark-sweep.png +0 -0
  56. data/assets/Garbage-Collection-nursery-1.png +0 -0
  57. data/assets/Garbage-Collection-nursery-2.png +0 -0
  58. data/assets/Garbage-Collection-nursery-3.png +0 -0
  59. data/assets/Garbage-Collection-nursery-4.png +0 -0
  60. data/assets/Garbage-Collection-nursery-5.png +0 -0
  61. data/assets/Garbage-Collection-process.png +0 -0
  62. data/assets/Garbage-Collection-ref-counting.png +0 -0
  63. data/assets/Interpreter-Optimization-interp.pdf +0 -0
  64. data/assets/Memory-Management-fig1.png +0 -0
  65. data/assets/Memory-Management-fig2.png +0 -0
  66. data/assets/Memory-Management-fig3.png +0 -0
  67. data/assets/Memory-Management-fig4.png +0 -0
  68. data/assets/Memory-Management-fig5.png +0 -0
  69. data/assets/Memory-Management-fig6.png +0 -0
  70. data/assets/Memory-Management-fig7.png +0 -0
  71. data/assets/Memory-Management-fig8.png +0 -0
  72. data/assets/Multicore-GIL-1.png +0 -0
  73. data/assets/Multicore-GIL-2.png +0 -0
  74. data/assets/My-Photo.JPG +0 -0
  75. data/assets/Operating-System-Virtualization-ept.png +0 -0
  76. data/assets/Operating-System-Virtualization-guest-page.png +0 -0
  77. data/assets/Operating-System-Virtualization-kvm-arch.png +0 -0
  78. data/assets/Operating-System-Virtualization-kvm-process.png +0 -0
  79. data/assets/Operating-System-Virtualization-kvm-qemu.png +0 -0
  80. data/assets/Operating-System-Virtualization-kvm-state.png +0 -0
  81. data/assets/Operating-System-Virtualization-vtx.png +0 -0
  82. data/assets/Operating-System-Virtualization-xen-arch.png +0 -0
  83. data/assets/Program-Profiling-profiling.pdf +0 -0
  84. data/assets/Programming-Language-Virtual-Machine-vm.pdf +0 -0
  85. data/assets/Remote-Shell-Session-Setup-1.png +0 -0
  86. data/assets/Signals-1.png +0 -0
  87. data/assets/Signals-2.png +0 -0
  88. data/assets/Signals-3.png +0 -0
  89. data/assets/Some-Slides-about-Containers-Kubernetes.pdf +0 -0
  90. data/assets/Some-Slides-about-Containers-UCSB-nurmi.pdf +0 -0
  91. data/assets/Some-Slides-about-PaaS-CS293B_CloudPlatforms.pdf +0 -0
  92. data/assets/avg-1thread.c +172 -0
  93. data/assets/avg-manythread.c +284 -0
  94. data/assets/avg-nothread.c +71 -0
  95. data/assets/file-create1.c +75 -0
  96. data/assets/file-create2.c +120 -0
  97. data/assets/file-fd1.c +56 -0
  98. data/assets/file-fd2.c +25 -0
  99. data/assets/file-fd3.c +23 -0
  100. data/assets/file-read1.c +62 -0
  101. data/assets/file-read2.c +66 -0
  102. data/assets/file-seek1.c +87 -0
  103. data/assets/fork-1.c +35 -0
  104. data/assets/fork-2.c +44 -0
  105. data/assets/fork-3.c +60 -0
  106. data/assets/fork-4.c +64 -0
  107. data/assets/joinall-1.c +163 -0
  108. data/assets/joinall-2.c +162 -0
  109. data/assets/market-kthreads.c +465 -0
  110. data/assets/market-semaphore.c +504 -0
  111. data/assets/market1.c +478 -0
  112. data/assets/market2.c +490 -0
  113. data/assets/market3.c +503 -0
  114. data/assets/market4.c +509 -0
  115. data/assets/my-cat.c +35 -0
  116. data/assets/pipe-1.c +45 -0
  117. data/assets/pipe-2.c +80 -0
  118. data/assets/pipe-3.c +83 -0
  119. data/assets/pipe-4.c +116 -0
  120. data/assets/race1.c +75 -0
  121. data/assets/race2.c +77 -0
  122. data/assets/race3.c +87 -0
  123. data/assets/race_ABC.c +144 -0
  124. data/assets/search-by-algolia.svg +1 -0
  125. data/assets/semaphore.book.ps +8827 -0
  126. data/assets/sys-call1.c +20 -0
  127. data/assets/sys-call2.c +16 -0
  128. data/assets//350/265/253/347/202/2161.PNG +0 -0
  129. data/feed.xml +30 -0
  130. data/index.html +164 -0
  131. data/js/jekyll-search.min.js +1 -0
  132. data/js/lunr.min.js +2977 -0
  133. data/js/main.js +57 -0
  134. data/js/masonry.pkgd.min.js +9 -0
  135. data/js/pageContent.js +166 -0
  136. data/js/search.js +17 -0
  137. data/js/smooth-scroll.min.js +2 -0
  138. data/js/waterfall.js +214 -0
  139. data/page/0archives.html +83 -0
  140. data/page/1category.html +62 -0
  141. data/page/2tags.html +64 -0
  142. data/page/3search.html +112 -0
  143. data/page/4about.md +34 -0
  144. metadata +270 -0
@@ -0,0 +1,87 @@
1
+ #include <unistd.h>
2
+ #include <stdlib.h>
3
+ #include <stdio.h>
4
+ #include <string.h>
5
+ #include <fcntl.h>
6
+
7
+ /*
8
+ * seek the file in the first argument to the location specified in the
9
+ * second
10
+ */
11
+ int main(int argc, char **argv)
12
+ {
13
+ int my_file_desc;
14
+ char file_name[4096];
15
+ char read_buffer[4096];
16
+ int i;
17
+ int r;
18
+ off_t offset;
19
+ off_t where;
20
+
21
+ if(argc < 3) {
22
+ printf("need to specify a file name and an offset\n");
23
+ exit(1);
24
+ }
25
+
26
+ /*
27
+ * zero out the buffer for the file name
28
+ */
29
+ for(i=0; i < sizeof(file_name); i++) {
30
+ file_name[i] = 0;
31
+ }
32
+
33
+ /*
34
+ * copy the argument into a local buffer
35
+ */
36
+ strncpy(file_name,argv[1],sizeof(file_name));
37
+ file_name[sizeof(file_name)-1] = 0;
38
+
39
+ /*
40
+ * get the offset from the second argument
41
+ */
42
+ offset = (off_t)atoi(argv[2]);
43
+
44
+ /*
45
+ * try and open the file for reading
46
+ */
47
+ my_file_desc = open(file_name,O_RDONLY,0);
48
+ if(my_file_desc < 0) {
49
+ printf("failed to open %s for reading\n",file_name);
50
+ exit(1);
51
+ }
52
+
53
+ /*
54
+ * seek to the offset specified in the second argument
55
+ */
56
+ where = lseek(my_file_desc,offset,SEEK_SET);
57
+
58
+ if(where < 0) {
59
+ printf("lseek to %d in file %s failed\n",
60
+ (int)offset,
61
+ file_name);
62
+ close(my_file_desc);
63
+ exit(1);
64
+ }
65
+
66
+ for(i=0; i < sizeof(read_buffer); i++) {
67
+ read_buffer[i] = 0;
68
+ }
69
+ r = read(my_file_desc,read_buffer,sizeof(read_buffer)-1);
70
+
71
+ /*
72
+ * read and print until EOF
73
+ */
74
+ while(r > 0) {
75
+ printf("%s",read_buffer);
76
+ for(i=0; i < sizeof(read_buffer); i++) {
77
+ read_buffer[i] = 0;
78
+ }
79
+ r = read(my_file_desc,read_buffer,sizeof(read_buffer)-1);
80
+ }
81
+ close(my_file_desc);
82
+
83
+ return(0);
84
+
85
+ }
86
+
87
+
data/assets/fork-1.c ADDED
@@ -0,0 +1,35 @@
1
+ #include <unistd.h>
2
+ #include <stdlib.h>
3
+ #include <stdio.h>
4
+ #include <string.h>
5
+ #include <fcntl.h>
6
+
7
+ /*
8
+ * simple program calling fork
9
+ */
10
+ int main(int argc, char **argv)
11
+ {
12
+ pid_t child_id;
13
+ pid_t my_id;
14
+
15
+ my_id = getpid();
16
+ printf("pid: %d -- I am the parent about to call fork\n",
17
+ (int)my_id);
18
+
19
+ child_id = fork();
20
+ if(child_id != 0) {
21
+ my_id = getpid();
22
+ printf("pid: %d -- I just forked a child with id %d\n",
23
+ (int)my_id,
24
+ (int)child_id);
25
+ } else {
26
+ my_id = getpid();
27
+ printf("pid: %d -- I am the child\n",my_id);
28
+ }
29
+
30
+ printf("pid: %d -- I am exiting\n",my_id);
31
+ exit(0);
32
+
33
+ }
34
+
35
+
data/assets/fork-2.c ADDED
@@ -0,0 +1,44 @@
1
+ #include <unistd.h>
2
+ #include <stdlib.h>
3
+ #include <stdio.h>
4
+ #include <string.h>
5
+ #include <fcntl.h>
6
+
7
+ /*
8
+ * simple program calling fork and wait
9
+ */
10
+ int main(int argc, char **argv)
11
+ {
12
+ pid_t child_id;
13
+ pid_t my_id;
14
+ int child_status;
15
+ int i;
16
+
17
+ child_id = fork();
18
+ if(child_id != 0) {
19
+ my_id = getpid();
20
+ printf("pid: %d -- I just forked a child with id %d\n",
21
+ (int)my_id,
22
+ (int)child_id);
23
+ printf("pid: %d -- I am waiting for process %d to finish\n",
24
+ (int)my_id,
25
+ (int)child_id);
26
+ wait(&child_status);
27
+ printf("pid: %d -- my child has completed with status: %d\n",
28
+ (int)my_id,
29
+ child_status);
30
+ } else {
31
+ my_id = getpid();
32
+ printf("pid: %d -- I am the child and I am going to count to 10\n",
33
+ (int)my_id);
34
+ for(i=0; i < 10; i++) {
35
+ printf("pid: %d -- %d\n",my_id,i+1);
36
+ }
37
+ }
38
+
39
+ printf("pid: %d -- I am exiting\n",my_id);
40
+ exit(0);
41
+
42
+ }
43
+
44
+
data/assets/fork-3.c ADDED
@@ -0,0 +1,60 @@
1
+ #include <unistd.h>
2
+ #include <stdlib.h>
3
+ #include <stdio.h>
4
+ #include <string.h>
5
+ #include <fcntl.h>
6
+
7
+ /*
8
+ * run a program using fork and execve
9
+ */
10
+ int main(int argc, char **argv, char **envp)
11
+ {
12
+ pid_t child_id;
13
+ pid_t my_id;
14
+ int child_status;
15
+ int i;
16
+ char file_name[4096];
17
+ int err;
18
+
19
+ if(argc < 2) {
20
+ printf("must specify file name as first argument\n");
21
+ exit(1);
22
+ }
23
+
24
+ memset(file_name,0,sizeof(file_name));
25
+ strncpy(file_name,argv[1],sizeof(file_name));
26
+
27
+ child_id = fork();
28
+ if(child_id != 0) {
29
+ my_id = getpid();
30
+ printf("pid: %d -- I forked pid: %d for: %s\n",
31
+ my_id,
32
+ child_id,
33
+ file_name);
34
+ wait(&child_status);
35
+ printf("pid: %d -- %s has completed with status: %d\n",
36
+ (int)my_id,
37
+ file_name,
38
+ child_status);
39
+ } else {
40
+ my_id = getpid();
41
+ printf("pid: %d -- I am the child and I am going to exec %s\n",
42
+ (int)my_id,
43
+ file_name);
44
+ err = execve(file_name,&(argv[1]),envp);
45
+ /*
46
+ * not reached if execve is successful
47
+ */
48
+ printf("pid: %d -- execve of %s failed with error %d\n",
49
+ (int)my_id,
50
+ file_name,
51
+ err);
52
+
53
+ }
54
+
55
+ printf("pid: %d -- I am exiting\n",my_id);
56
+ exit(0);
57
+
58
+ }
59
+
60
+
data/assets/fork-4.c ADDED
@@ -0,0 +1,64 @@
1
+ #include <unistd.h>
2
+ #include <stdlib.h>
3
+ #include <stdio.h>
4
+ #include <string.h>
5
+ #include <fcntl.h>
6
+ #include <sys/wait.h>
7
+
8
+ /*
9
+ * run a program using fork and execve
10
+ * pring the status correctly
11
+ */
12
+ int main(int argc, char **argv, char **envp)
13
+ {
14
+ pid_t child_id;
15
+ pid_t my_id;
16
+ int child_status;
17
+ int i;
18
+ char file_name[4096];
19
+ int err;
20
+
21
+ if(argc < 2) {
22
+ printf("must specify file name as first argument\n");
23
+ exit(1);
24
+ }
25
+
26
+ memset(file_name,0,sizeof(file_name));
27
+ strncpy(file_name,argv[1],sizeof(file_name));
28
+
29
+ child_id = fork();
30
+ if(child_id != 0) {
31
+ my_id = getpid();
32
+ printf("pid: %d -- I forked pid: %d for: %s\n",
33
+ my_id,
34
+ child_id,
35
+ file_name);
36
+ wait(&child_status);
37
+ if(WIFEXITED(child_status)) {
38
+ printf("pid: %d -- %s has completed with status: %d\n",
39
+ (int)my_id,
40
+ file_name,
41
+ WEXITSTATUS(child_status));
42
+ }
43
+ } else {
44
+ my_id = getpid();
45
+ printf("pid: %d -- I am the child and I am going to exec %s\n",
46
+ (int)my_id,
47
+ file_name);
48
+ err = execve(file_name,&(argv[1]),envp);
49
+ /*
50
+ * not reached if execve is successful
51
+ */
52
+ printf("pid: %d -- execve of %s failed with error %d\n",
53
+ (int)my_id,
54
+ file_name,
55
+ err);
56
+
57
+ }
58
+
59
+ printf("pid: %d -- I am exiting\n",my_id);
60
+ exit(0);
61
+
62
+ }
63
+
64
+
@@ -0,0 +1,163 @@
1
+ /*
2
+ * cs170 -- Rich wolski
3
+ * ping-pong code illustrating kt_joinall() functionality
4
+ */
5
+ #include <unistd.h>
6
+ #include <stdlib.h>
7
+ #include <stdio.h>
8
+ #include <string.h>
9
+
10
+ #include "kt.h"
11
+
12
+ #define RAND() (drand48())
13
+
14
+ struct thread_arg
15
+ {
16
+ int id;
17
+ int count;
18
+ double *shared_counter;
19
+ kt_sem next;
20
+ int *finished;
21
+ int verbose;
22
+ };
23
+
24
+ /*
25
+ * bumps the shared counter by 1 each time it is enabled
26
+ */
27
+ void *PingPongThread(void *arg)
28
+ {
29
+ struct thread_arg *ta = (struct thread_arg *)arg;
30
+ int i;
31
+
32
+ for(i=0; i < ta->count; i++) {
33
+ P_kt_sem(ta->next);
34
+ *(ta->shared_counter) =
35
+ *(ta->shared_counter) + 1.0;
36
+ if(ta->verbose == 1) {
37
+ printf("thread %d: incremented shared counter to %f\n",
38
+ ta->id,
39
+ *(ta->shared_counter));
40
+ }
41
+ V_kt_sem(ta->next);
42
+ }
43
+
44
+ *(ta->finished) = *(ta->finished) + 1;
45
+
46
+ kt_exit();
47
+ return(NULL);
48
+ }
49
+
50
+ #define ARGS "t:VC:"
51
+ char *Usage = "ping-pong-joinall -C count -t threads -V <verbose on>\n";
52
+
53
+
54
+ int main(int argc, char **argv)
55
+ {
56
+ int c;
57
+ int threads;
58
+ struct thread_arg *ta;
59
+ void **ids;
60
+ double counter;
61
+ int done_threads;
62
+ int count;
63
+ int verbose;
64
+ int i;
65
+ kt_sem sema;
66
+
67
+
68
+ /*
69
+ * defaults
70
+ */
71
+ threads = 1;
72
+ counter = 0;
73
+ count = 1;
74
+ while((c = getopt(argc,argv,ARGS)) != EOF) {
75
+ switch(c) {
76
+ case 'C':
77
+ count = atoi(optarg);
78
+ break;
79
+ case 't':
80
+ threads = atoi(optarg);
81
+ break;
82
+ case 'V':
83
+ verbose = 1;
84
+ break;
85
+ default:
86
+ fprintf(stderr,
87
+ "unrecognized command %c\n",
88
+ (char)c);
89
+ fprintf(stderr,"usage: %s",Usage);
90
+ exit(1);
91
+ }
92
+ }
93
+
94
+ ids = (void **)malloc(threads*sizeof(void *));
95
+ if(ids == NULL) {
96
+ exit(1);
97
+ }
98
+
99
+ ta = (struct thread_arg *)malloc(threads*sizeof(struct thread_arg));
100
+ if(ta == NULL) {
101
+ exit(1);
102
+ }
103
+
104
+ sema = make_kt_sem(0);
105
+ if(sema == NULL) {
106
+ exit(1);
107
+ }
108
+
109
+ done_threads = 0;
110
+ for(i=0; i < threads; i++) {
111
+ ta[i].id = i;
112
+ ta[i].next = sema;
113
+ ta[i].count = count;
114
+ ta[i].shared_counter = &counter;
115
+ ta[i].finished = &done_threads;
116
+ ta[i].verbose = verbose;
117
+ ids[i] = kt_fork(PingPongThread,(void *)&ta[i]);
118
+ if(ids[i] == NULL) {
119
+ fprintf(stderr,"thread create %d failed\n",i);
120
+ exit(1);
121
+ }
122
+ }
123
+
124
+ V_kt_sem(sema); /* enable a thread */
125
+ /*
126
+ * loop showing progress
127
+ */
128
+ while(done_threads < threads) {
129
+ printf("shared counter: %f\n",counter);
130
+ fflush(stdout);
131
+ kt_joinall(); /* gets here when all else is stopped */
132
+ }
133
+
134
+ /*
135
+ * join with the threads after exit
136
+ */
137
+ for(i=0; i < threads; i++) {
138
+ kt_join(ids[i]);
139
+ }
140
+
141
+ kill_kt_sem(sema);
142
+ free(ta);
143
+ free(ids);
144
+
145
+ printf("final count: %f\n",counter);
146
+
147
+ return(0);
148
+ }
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+