jekyll-theme-gaeblogx 0.2 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +63 -5
  3. data/assets/page/{4about.html → 4about.md} +0 -0
  4. metadata +2 -100
  5. data/assets/10.jpg +0 -0
  6. data/assets/AWS-Introduction-ec2.png +0 -0
  7. data/assets/Cache-Oblivious-Algorithms-FunnelSort.jpg +0 -0
  8. data/assets/Condition-Variables-fig1.png +0 -0
  9. data/assets/Dynamic-Compilation-adaptJVM.pdf +0 -0
  10. data/assets/Dynamic-Compilation-dyncomp.pdf +0 -0
  11. data/assets/Fibonacci-Heap-Fig3.png +0 -0
  12. data/assets/Fibonacci-Heap-Fig5.png +0 -0
  13. data/assets/Fibonacci-Heap-Fig6.png +0 -0
  14. data/assets/Fibonacci-Heap-Fig7.png +0 -0
  15. data/assets/File-System-bc.jpg +0 -0
  16. data/assets/File-System-filetable.rich.jpg +0 -0
  17. data/assets/GIL-Battle.png +0 -0
  18. data/assets/GIL-CPU.png +0 -0
  19. data/assets/GIL-Check.png +0 -0
  20. data/assets/GIL-IO.png +0 -0
  21. data/assets/GIL-Measure-1.png +0 -0
  22. data/assets/GIL-Measure-2.png +0 -0
  23. data/assets/GIL-Signal.png +0 -0
  24. data/assets/GIL-Tick.png +0 -0
  25. data/assets/Garbage-Collection-Slides-gc.pdf +0 -0
  26. data/assets/Garbage-Collection-copying-1.png +0 -0
  27. data/assets/Garbage-Collection-copying-2.png +0 -0
  28. data/assets/Garbage-Collection-free-list.png +0 -0
  29. data/assets/Garbage-Collection-generation-1.png +0 -0
  30. data/assets/Garbage-Collection-mark-sweep.png +0 -0
  31. data/assets/Garbage-Collection-nursery-1.png +0 -0
  32. data/assets/Garbage-Collection-nursery-2.png +0 -0
  33. data/assets/Garbage-Collection-nursery-3.png +0 -0
  34. data/assets/Garbage-Collection-nursery-4.png +0 -0
  35. data/assets/Garbage-Collection-nursery-5.png +0 -0
  36. data/assets/Garbage-Collection-process.png +0 -0
  37. data/assets/Garbage-Collection-ref-counting.png +0 -0
  38. data/assets/Interpreter-Optimization-interp.pdf +0 -0
  39. data/assets/Memory-Management-fig1.png +0 -0
  40. data/assets/Memory-Management-fig2.png +0 -0
  41. data/assets/Memory-Management-fig3.png +0 -0
  42. data/assets/Memory-Management-fig4.png +0 -0
  43. data/assets/Memory-Management-fig5.png +0 -0
  44. data/assets/Memory-Management-fig6.png +0 -0
  45. data/assets/Memory-Management-fig7.png +0 -0
  46. data/assets/Memory-Management-fig8.png +0 -0
  47. data/assets/Multicore-GIL-1.png +0 -0
  48. data/assets/Multicore-GIL-2.png +0 -0
  49. data/assets/My-Photo.JPG +0 -0
  50. data/assets/Operating-System-Virtualization-ept.png +0 -0
  51. data/assets/Operating-System-Virtualization-guest-page.png +0 -0
  52. data/assets/Operating-System-Virtualization-kvm-arch.png +0 -0
  53. data/assets/Operating-System-Virtualization-kvm-process.png +0 -0
  54. data/assets/Operating-System-Virtualization-kvm-qemu.png +0 -0
  55. data/assets/Operating-System-Virtualization-kvm-state.png +0 -0
  56. data/assets/Operating-System-Virtualization-vtx.png +0 -0
  57. data/assets/Operating-System-Virtualization-xen-arch.png +0 -0
  58. data/assets/Program-Profiling-profiling.pdf +0 -0
  59. data/assets/Programming-Language-Virtual-Machine-vm.pdf +0 -0
  60. data/assets/Remote-Shell-Session-Setup-1.png +0 -0
  61. data/assets/Signals-1.png +0 -0
  62. data/assets/Signals-2.png +0 -0
  63. data/assets/Signals-3.png +0 -0
  64. data/assets/Some-Slides-about-Containers-Kubernetes.pdf +0 -0
  65. data/assets/Some-Slides-about-Containers-UCSB-nurmi.pdf +0 -0
  66. data/assets/Some-Slides-about-PaaS-CS293B_CloudPlatforms.pdf +0 -0
  67. data/assets/avg-1thread.c +0 -172
  68. data/assets/avg-manythread.c +0 -284
  69. data/assets/avg-nothread.c +0 -71
  70. data/assets/file-create1.c +0 -75
  71. data/assets/file-create2.c +0 -120
  72. data/assets/file-fd1.c +0 -56
  73. data/assets/file-fd2.c +0 -25
  74. data/assets/file-fd3.c +0 -23
  75. data/assets/file-read1.c +0 -62
  76. data/assets/file-read2.c +0 -66
  77. data/assets/file-seek1.c +0 -87
  78. data/assets/fork-1.c +0 -35
  79. data/assets/fork-2.c +0 -44
  80. data/assets/fork-3.c +0 -60
  81. data/assets/fork-4.c +0 -64
  82. data/assets/joinall-1.c +0 -163
  83. data/assets/joinall-2.c +0 -162
  84. data/assets/market-kthreads.c +0 -465
  85. data/assets/market-semaphore.c +0 -504
  86. data/assets/market1.c +0 -478
  87. data/assets/market2.c +0 -490
  88. data/assets/market3.c +0 -503
  89. data/assets/market4.c +0 -509
  90. data/assets/my-cat.c +0 -35
  91. data/assets/pipe-1.c +0 -45
  92. data/assets/pipe-2.c +0 -80
  93. data/assets/pipe-3.c +0 -83
  94. data/assets/pipe-4.c +0 -116
  95. data/assets/race1.c +0 -75
  96. data/assets/race2.c +0 -77
  97. data/assets/race3.c +0 -87
  98. data/assets/race_ABC.c +0 -144
  99. data/assets/semaphore.book.ps +0 -8827
  100. data/assets/sys-call1.c +0 -20
  101. data/assets/sys-call2.c +0 -16
  102. data/assets//350/265/253/347/202/2161.PNG +0 -0
@@ -1,284 +0,0 @@
1
- #include <unistd.h>
2
- #include <stdlib.h>
3
- #include <stdio.h>
4
-
5
- #include <pthread.h>
6
-
7
- /*
8
- * program to find the average value of a set of random numbers
9
- * which forks off #t# threads to do the sum computation in parallel
10
- *
11
- * usage: avg-manythread count
12
- *
13
- * where count is the number of random values to generate
14
- */
15
-
16
- char *Usage = "usage: avg-manythread count threads";
17
-
18
- #define RAND() (drand48()) /* basic Linux random number generator */
19
-
20
- /*
21
- * data type definition for arguments passed to thread
22
- */
23
- struct arg_struct
24
- {
25
- int id;
26
- int size;
27
- double *data;
28
- int starting_i;
29
- };
30
-
31
- /*
32
- * data type definition for results passed back from threads
33
- */
34
- struct result_struct
35
- {
36
- double sum;
37
- };
38
-
39
- void *SumThread(void *arg)
40
- {
41
- int i;
42
- double my_sum;
43
- struct arg_struct *my_args;
44
- int my_size;
45
- double *my_data;
46
- struct result_struct *result;
47
- int my_start;
48
- int my_end;
49
- int my_id;
50
-
51
- my_args = (struct arg_struct *)arg;
52
- result = (struct result_struct *)malloc(sizeof(struct result_struct));
53
- if(result == NULL) {
54
- exit(1);
55
- }
56
-
57
- printf("sum thread %d running, starting at %d for %d\n",
58
- my_args->id,
59
- my_args->starting_i,
60
- my_args->size);
61
- fflush(stdout);
62
-
63
- my_id = my_args->id;
64
- my_size = my_args->size;
65
- my_data = my_args->data;
66
- my_start = my_args->starting_i;
67
-
68
- /*
69
- * free the arg structure -- it isn't needed any more
70
- */
71
- free(my_args);
72
-
73
- /*
74
- * figure out the ending index for my subregion
75
- */
76
- my_end = my_start + my_size;
77
-
78
- my_sum = 0.0;
79
- for(i=my_start; i < my_end; i++) {
80
- my_sum += my_data[i];
81
- }
82
-
83
- result->sum = my_sum;
84
-
85
- printf("sum thread %d returning\n",
86
- my_id);
87
- fflush(stdout);
88
-
89
- return((void *)result);
90
- }
91
-
92
- int main(int argc, char **argv)
93
- {
94
- int i;
95
- int t;
96
- double sum;
97
- double *data;
98
- int count;
99
- int threads;
100
- struct arg_struct *args;
101
- struct result_struct *result;
102
- int err;
103
- pthread_t *thread_ids;
104
- int range_size;
105
- int index;
106
-
107
- /*
108
- * santity check the arguments
109
- */
110
- if(argc <= 2) {
111
- fprintf(stderr,"must specify count and number of threads to use\n");
112
- fprintf(stderr,"%s",Usage);
113
- exit(1);
114
- }
115
-
116
- count = atoi(argv[1]); /* count is first argument */
117
-
118
- if(count <= 0) {
119
- fprintf(stderr,"invalid count %d\n",count);
120
- exit(1);
121
- }
122
-
123
- threads = atoi(argv[2]); /* thread count is second arg */
124
-
125
- if(threads <= 0) {
126
- fprintf(stderr,"invalid thread count %d\n",threads);
127
- exit(1);
128
- }
129
-
130
- /*
131
- * don't allow more threads than data elements
132
- */
133
- if(threads > count) {
134
- threads = count;
135
- }
136
-
137
- /*
138
- * make an array large enough to hold #count# doubles
139
- */
140
- data = (double *)malloc(count * sizeof(double));
141
- if(data == NULL) {
142
- exit(1);
143
- }
144
-
145
- /*
146
- * pick a bunch of random numbers
147
- */
148
- for(i=0; i < count; i++) {
149
- data[i] = RAND();
150
- }
151
-
152
-
153
- /*
154
- * make a data structure to hold the thread ids so that the spawning
155
- * thread can join with each one separately
156
- */
157
- thread_ids = (pthread_t *)malloc(sizeof(pthread_t)*threads);
158
- if(thread_ids == NULL) {
159
- exit(1);
160
- }
161
-
162
- /*
163
- * fork off #threads# threads giving each a more or less even number
164
- * of values to sum from the master list
165
- *
166
- * each thread gets its own arg structure with the same pointer to the
167
- * data
168
- *
169
- * first, divide the list size by the number of threads to get an even
170
- * distribution of work.
171
- */
172
- range_size = (count / threads) + 1;
173
-
174
- /*
175
- * handle the possibility that #threads# divides #count# evenly
176
- */
177
- if(((range_size-1) * threads) == count) {
178
- range_size -= 1;
179
- }
180
-
181
- printf("main thread about to create %d sum threads\n",
182
- threads);
183
- fflush(stdout);
184
- /*
185
- * create one thread to sum each subregion of the data array
186
- * start with index 0
187
- */
188
- index = 0;
189
- for(t=0; t < threads; t++) {
190
- /*
191
- * make a argument structure to use to pass the arguments to the
192
- * thread
193
- */
194
- args = (struct arg_struct *)malloc(sizeof(struct arg_struct));
195
- if(args == NULL) {
196
- exit(1);
197
- }
198
- /*
199
- * give this thread an integer id
200
- */
201
- args->id = (t+1);
202
- /*
203
- * give each thread the size of the subregion and the same pointer to the
204
- * data array
205
- */
206
- args->size = range_size;
207
- args->data = data;
208
- /*
209
- * set the starting and ending index for the next thread
210
- */
211
- args->starting_i = index;
212
- /*
213
- * sanity chek to make sure we don't go out of bounds on the
214
- * last thread in the case there #count# does not divide
215
- * evenly
216
- */
217
- if((args->starting_i + args->size) > count) {
218
- args->size = count - args->starting_i;
219
- }
220
- printf("main thread creating sum thread %d\n",
221
- t+1);
222
- fflush(stdout);
223
- /*
224
- * fork this thread and remember its id in the array of thread
225
- * ids
226
- */
227
- err = pthread_create(&(thread_ids[t]), NULL, SumThread, (void *)args);
228
- if(err != 0) {
229
- fprintf(stderr,
230
- "pthread create failed for thread %d\n", t);
231
- exit(1);
232
- }
233
- printf("main thread has created sum thread %d\n",
234
- t+1);
235
- /*
236
- * set the starting index for the next thread
237
- */
238
- index += range_size;
239
- }
240
-
241
- /*
242
- * join with each thread one at a time and
243
- * get its partial sum and make a global sum
244
- */
245
- sum = 0;
246
- for(t=0; t < threads; t++) {
247
- /*
248
- * wait until the next sum thread is finished and get the result back
249
- */
250
- printf("main thread about to join with sum thread %d\n",t+1);
251
- fflush(stdout);
252
- err = pthread_join(thread_ids[t],(void **)&result);
253
- if(err != 0) {
254
- fprintf(stderr,"pthread_join failed for thread %d\n",
255
- t);
256
- exit(1);
257
- }
258
- printf("main thread joined with sum thread %d\n",t+1);
259
- fflush(stdout);
260
- /*
261
- * add in the partial sum
262
- */
263
- sum += result->sum;
264
- /*
265
- * free this thread's result structure
266
- */
267
- free(result);
268
- }
269
-
270
- printf("the average over %d random numbers on (0,1) is %f\n",
271
- count, sum / (double)count);
272
-
273
- /*
274
- * free the thread id array
275
- */
276
- free(thread_ids);
277
- /*
278
- * free the data array
279
- */
280
- free(data);
281
-
282
- return(0);
283
- }
284
-
@@ -1,71 +0,0 @@
1
- #include <unistd.h>
2
- #include <stdlib.h>
3
- #include <stdio.h>
4
-
5
- /*
6
- * program to find the average value of a set of random numbers
7
- *
8
- * usage: avg-nothread count
9
- *
10
- * where count is the number of random values to generate
11
- */
12
-
13
- char *Usage = "usage: avg-nothread count";
14
-
15
- #define RAND() (drand48()) /* basic Linux random number generator */
16
-
17
- int main(int argc, char **argv)
18
- {
19
- int i;
20
- int n;
21
- double *data;
22
- double sum;
23
- int count;
24
-
25
- /*
26
- * santity check the arguments
27
- */
28
- if(argc <= 1) {
29
- fprintf(stderr,"must specify count\n");
30
- fprintf(stderr,"%s",Usage);
31
- exit(1);
32
- }
33
-
34
- count = atoi(argv[1]); /* count is first argument */
35
-
36
- if(count <= 0) {
37
- fprintf(stderr,"invalid count %d\n",count);
38
- exit(1);
39
- }
40
-
41
- /*
42
- * make an array large enough to hold #count# doubles
43
- */
44
- data = (double *)malloc(count * sizeof(double));
45
- if(data == NULL) {
46
- exit(1);
47
- }
48
-
49
- /*
50
- * pick a bunch of random numbers
51
- */
52
- for(i=0; i < count; i++) {
53
- data[i] = RAND();
54
- }
55
-
56
- /*
57
- * now scan through them and compute the sum
58
- */
59
- sum = 0;
60
- for(i=0; i < count; i++) {
61
- sum += data[i];
62
- }
63
-
64
- printf("the average over %d random numbers on (0,1) is %f\n",
65
- count, sum/(double)count);
66
-
67
- free(data);
68
-
69
- return(0);
70
- }
71
-
@@ -1,75 +0,0 @@
1
- #include <unistd.h>
2
- #include <stdlib.h>
3
- #include <stdio.h>
4
- #include <string.h>
5
- #include <fcntl.h>
6
-
7
- /*
8
- * open to create a file and write a string into it
9
- */
10
- int main(int argc, char **argv)
11
- {
12
- int my_file_desc;
13
- char file_name[4096];
14
- char write_buffer[4096];
15
- int write_length;
16
- char *string;
17
- int i;
18
- int w;
19
-
20
- if(argc < 2) {
21
- printf("need to specify a file name as the first argument\n");
22
- exit(1);
23
- }
24
-
25
- /*
26
- * zero out the buffer for the file name
27
- */
28
- for(i=0; i < sizeof(file_name); i++) {
29
- file_name[i] = 0;
30
- }
31
-
32
- /*
33
- * copy the argument into a local buffer
34
- */
35
- strncpy(file_name,argv[1],sizeof(file_name));
36
- file_name[sizeof(file_name)-1] = 0;
37
-
38
- /*
39
- * try and open the file for creation
40
- */
41
- my_file_desc = open(file_name,O_CREAT | O_WRONLY,0600);
42
- if(my_file_desc < 0) {
43
- printf("failed to open %s for creation\n",file_name);
44
- exit(1);
45
- }
46
-
47
- /*
48
- * file is open, write a string into it
49
- */
50
- string =
51
- "This program brought to you by the council for better C programming";
52
- for(i=0; i < sizeof(write_buffer); i++) {
53
- write_buffer[i] = 0;
54
- }
55
- strncpy(write_buffer,string,sizeof(write_buffer));
56
-
57
- write_length = strlen(write_buffer);
58
-
59
- w = write(my_file_desc,write_buffer,write_length);
60
-
61
- if(w != write_length) {
62
- printf("write didn't complete, w: %d, length: %d\n",
63
- w,
64
- write_length);
65
- close(my_file_desc);
66
- exit(1);
67
- }
68
-
69
- close(my_file_desc);
70
-
71
- return(0);
72
-
73
- }
74
-
75
-
@@ -1,120 +0,0 @@
1
- #include <unistd.h>
2
- #include <stdlib.h>
3
- #include <stdio.h>
4
- #include <string.h>
5
- #include <fcntl.h>
6
-
7
- /*
8
- * open to create a couple of files and write a strings into each
9
- */
10
- int main(int argc, char **argv)
11
- {
12
- int fd1;
13
- int fd2;
14
- char file_name1[4096];
15
- char file_name2[4096];
16
- char write_buffer[4096];
17
- int write_length;
18
- char *string;
19
- int i;
20
- int w;
21
-
22
- if(argc < 3) {
23
- printf("need to specify two file names as the first and second arguments\n");
24
- exit(1);
25
- }
26
-
27
- /*
28
- * zero out the buffers for the file names
29
- */
30
- for(i=0; i < sizeof(file_name1); i++) {
31
- file_name1[i] = 0;
32
- file_name2[i] = 0;
33
- }
34
-
35
- /*
36
- * copy the first argument into a local buffer
37
- */
38
- strncpy(file_name1,argv[1],sizeof(file_name1));
39
- file_name1[sizeof(file_name1)-1] = 0;
40
-
41
- /*
42
- * and the second
43
- */
44
- strncpy(file_name2,argv[2],sizeof(file_name2));
45
- file_name2[sizeof(file_name2)-1] = 0;
46
-
47
- /*
48
- * try and open the first file for creation
49
- */
50
- fd1 = open(file_name1,O_CREAT | O_WRONLY, 0600);
51
- if(fd1 < 0) {
52
- printf("failed to open %s for creation\n",file_name1);
53
- exit(1);
54
- }
55
-
56
- /*
57
- * and the second
58
- */
59
- fd2 = open(file_name2,O_CREAT | O_WRONLY, 0600);
60
- if(fd2 < 0) {
61
- printf("failed to open %s for creation\n",file_name2);
62
- close(fd1);
63
- exit(1);
64
- }
65
-
66
- /*
67
- * both files are open, write a string into first
68
- */
69
- string =
70
- "This program brought to you by the council for better C programming";
71
- for(i=0; i < sizeof(write_buffer); i++) {
72
- write_buffer[i] = 0;
73
- }
74
- strncpy(write_buffer,string,sizeof(write_buffer));
75
-
76
- write_length = strlen(write_buffer);
77
-
78
- w = write(fd1,write_buffer,write_length);
79
-
80
- if(w != write_length) {
81
- printf("write didn't complete, w: %d, length: %d in %s\n",
82
- w,
83
- write_length,
84
- file_name1);
85
- close(fd1);
86
- close(fd2);
87
- exit(1);
88
- }
89
-
90
- /*
91
- * and the second
92
- */
93
- string = "C programming is both nutritious and great tasting.";
94
- for(i=0; i < sizeof(write_buffer); i++) {
95
- write_buffer[i] = 0;
96
- }
97
- strncpy(write_buffer,string,sizeof(write_buffer));
98
-
99
- write_length = strlen(write_buffer);
100
-
101
- w = write(fd2,write_buffer,write_length);
102
-
103
- if(w != write_length) {
104
- printf("write didn't complete, w: %d, length: %d in %s\n",
105
- w,
106
- write_length,
107
- file_name2);
108
- close(fd1);
109
- close(fd2);
110
- exit(1);
111
- }
112
-
113
- close(fd1);
114
- close(fd2);
115
-
116
- return(0);
117
-
118
- }
119
-
120
-