A. b, c, d B. b, d C. c, d D. c, e E. c, d, e one-sentence (12) For each of the
ID: 3598932 • Letter: A
Question
A. b, c, d B. b, d C. c, d D. c, e E. c, d, e one-sentence (12) For each of the following justification (3 points for each). statements indicate whether it is true or false, and give a w a. A process is a progranm. ong-term scheduler which selects which processes should be brought into the ready queue. Time-Sharing system ex tasks that they carry out. c. ecutes programs that are guaranteed to have an upper bound on switches than FCFS. d. Round-robin scheduling never results in more context (20) Explain what will be output for the following program? 3. #include #include #include int value 5; int main pid t pid; pid-fork0: printf"I am the child process. In"); value+ 15; else if (pid>0) wait (NULL); printe"I am the parent process, value:%d ", value); exit(0);Explanation / Answer
2 (a) True-Process is an instance of program that is running.
(b) False- CPU Scheduler is a short term scheduler, CPU scheduler selects a process among the processes that are ready to execute and allocates CPU to one of them.
(c) True- Time-sharing is a technique which enables many people, located at various terminals, to use a particular computer system at the same time. Time-sharing or multitasking is a logical extension of multiprogramming. Processor's time which is shared among multiple users simultaneously is termed as time-sharing. Time sharing systems have an upper bound on tasks that they carry out.
(d) False- Round Robin algorithms have more overhead due to more number of context switches than FCFS.
3. When fork() function is called, parent-child process is created where child shares same code as the parent.
Output:
I am child process
20
I am parent process
20
or
I am parent process
5
I am child process
20
Reason:
After fork() statement,
Case 1. if child is invoked first, pid is 0,therefore global value is changed to 20.
Then, parent process executes, its global value remains 20.
Case 2. if parent is invoked first, its pid is greater than 0, global value remains 5.
When child process excutes, the global value becomes 20.
Hence, above output results.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.