Question:
(a) Answer the following questions based on the code snippet below.
1. int main (int argc, char *argv[])
2. {
3.
4. pid_t processId;
5.
6. processId = fork ();
7.
8.
9. if (processId == 0) {
10. if (execl ("/usr/bin/ls", "ls", 0) == -1) {
11. perror ("execl failed ");
12. exit (1);
13. }
14. exit (0);
15.
16. } else { // processId greater than 0 case
17. wait (0);
18. exit (0);
19. }
20. return 0;
21. }
(i) Explain what happens after line 6 is executed.
(ii) Who (parent or child) executes code between lines 10-14?
(iii) Explain what is happening at line 10.
(iv) What is happening at line 17?
(b) Discuss why we have different processor modes and how these modes are used in typical operating systems.
(iii) (c) (i) What is meant by the term ‘affinity' in processor sheduling?
(ii) Discuss briefly the major issues that need to be addressed in designing multiprocessor operating systems.
Discuss any two of the following multiprocessor scheduling strategies
- Smart Scheduling
- Gang Scheduling
- Space Sharing