Question: 3. (10 pts) Write a multithread C program to count the number of prime numbers within a given range [low,high] (inclusive), where the program should

 3. (10 pts) Write a multithread C program to count the
number of prime numbers within a given range [low,high] (inclusive), where the

3. (10 pts) Write a multithread C program to count the number of prime numbers within a given range [low,high] (inclusive), where the program should be able to take in the number of threads as an argument. You may use this single thread program in anyway you like. ( Here is a reference implmentation ( executable only ), and you can check your results against this one to see if they match.) 4. (10 pts) Write a simple test program to find out the parent process id of a process before and after its parent process terminates. Based on your test results, answer the following question: what is a process's parent process after its original parent process terminates? 5. (10 pts) Write a simple test program to find out PIDs of ALL ancestor (i.e., parent, grandparent) processes of the current process or a given process specified by a PID. A parent process's PID of a given process pid can be found in /proc/Spid/status 6. (20 pts) Problem 1.35. Run the program on your OWN laptop/desktop, and record the maximum number of child processes you see before your system crashes, as well as your machine's memory size. (For those who doesn't have this edition of the textbook, the problem is as follows: If you have a personal UNIX-like system available that you can safely crash and reboot, write a shell script that attempts to create an unlimited number of child processes and observe what happens. Before running the experiment, type sync to the shell to flush the file system buffers to disk to avoid ruining the file system.) Again, do NOT run the experiment on any shared system. You can write a CICH program instead of shell script for this experiment. Do NOT search for solutions.( There is one on internet, but I doubt you would understand it, otherwise you wouldn't need to take this course now.) 7. (20 pts) Design and run an experiment to measure the CPU time used by fork. (You may want to use the system call times.) Also report the CPU of the machine you run the experiment

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!