14 Sep 2016 - 10:22pm

#include #include int main() { int i; for (i=0; i<3; i++) { pid_t pid = fork(); if (pid == 0) printf("parent:[%d] current:[%d] i=%d\n", getppid(), getpid(), i); else printf("FORK Failed for current: %d\n", getpid()); printf("*\n"); } printf("HI \n"); return 0; }

more less
13 Sep 2016 - 2:14am

Tricky problem.

Please search for Fork() bomb.

more less
14 Jun 2016 - 11:32pm

char c= 99 is correct. No compilation error. c can take values from -127 to +127. c=99, if you print with %d in printf, you will see output 99. If you print c using %c in printf, you will see output as c, 99 is ASCII for c.

more less

Good approach given above. Another good reading on this matter can be found on this link http://www.techtud.com/resource-share/average-case-analysis

more less

Yes both are equal. I hope you understand base of the log is 2. 

Lets assume

y = 2logn

log2y = log22logn

log2y = log2n . log22

log2y = log2n. 1 

log2y = log2n

So, y = n.

more less
13 Jun 2016 - 1:53am

1) fun(200) --> as i%2 will be equal to 0, which is false, so else part is executed and fun(fun(199)) is called, from which inner call will take place first i.e. fun(199) and outer function will use value returned by inner call.

2) fun(199) {Inner Call}  --> as i%2 will be equal to 1, which is true, so return instruction is executed. Now return i++ , return original value of i and then increment the value. So the value returned will be 199 and this value will be used by outer call now.

3) fun(199) {Outer Call) --> same as above. The value, 199, returned by this call will be there in Main and printed.

Output: 199.

The concept is explained above.

Execution output can be seen in link: https://ideone.com/8RlhFe

more less

The easy way to understand and remember locality of reference is Spatial is for Space and temporal for time.

A) It tells about time.

B) Same as A.

C) It does not remember the lines which are written only.

Suppose you read byte number 5, which also is cache line number 5, if only one byte is in one cache line. Spatial locality says nearby bytes of accessed data is likely to be accessed next. Now there is NO bytes in cache line number 5 which can be cached to get the benefit of locality. Had it been more than 1 byte, say 2 or 3, you would have copied that whole cache line and next accessed byte, say number 6 or 7 would have been in cache, getting the benefit of spatial locality.

more less

Kishor, Techtud is community contribution platform. I am sure someone will surely contribute good lectures on COA. Until then, why don't you start with resources available at http://www.techtud.com/computer-science-and-information-technology/computer-organization-and-architecture . Ask any doubt which comes to your mind. 

more less