0% found this document useful (0 votes)
12 views6 pages

Process Management and Scheduling Insights

This document contains 18 multiple choice and short answer exercises about operating system processes and concurrency. The exercises cover topics like process scheduling, context switching, process creation, interprocess communication using pipes and RPC, and ensuring reliability in distributed systems. Students are asked to describe differences in scheduling approaches, the steps in context switching, how processes are related in a process tree, and the outcomes of code snippets involving processes and IPC.

Uploaded by

Nguyễn Quân
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views6 pages

Process Management and Scheduling Insights

This document contains 18 multiple choice and short answer exercises about operating system processes and concurrency. The exercises cover topics like process scheduling, context switching, process creation, interprocess communication using pipes and RPC, and ensuring reliability in distributed systems. Students are asked to describe differences in scheduling approaches, the steps in context switching, how processes are related in a process tree, and the outcomes of code snippets involving processes and IPC.

Uploaded by

Nguyễn Quân
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Chapter 2.

1 Process
3.1 Using the program shown in Figure 3.30, explain what the output will be at LINE A.

3.2 Including the initial parent process, how many processes are created by the program shown
in Figure 3.31?

3.3 Original versions of Apple’s mobile iOS operating system provided no means of concurrent
processing. Discuss three major complications that concurrent processing adds to an operating
system.
3.4 The Sun UltraSPARC processor has multiple register sets. Describe what happens when a
context switch occurs if the new context is already loaded into one of the register sets. What
happens if the new context is in memory rather than in a register set and all the register sets are
in use?
3.5 When a process creates a newprocess using the fork() operation,which of the following states
is shared between the parent process and the child process?
a. Stack
b. Heap
c. Shared memory segments
3.6 Consider the “exactly once”semanticwith respect to the RPCmechanism. Does the algorithm
for implementing this semantic execute correctly even if the ACK message sent back to the
client is lost due to a network problem? Describe the sequence of messages, and discuss whether
“exactly once” is still preserved.
3.7 Assume that a distributed system is susceptible to server failure. What mechanismswould be
required to guarantee the “exactly once” semantic for execution of RPCs?

Exercises
3.8 Describe the differences among short-term, medium-term, and long-term scheduling.

3.9 Describe the actions taken by a kernel to context-switch between processes.


3.10 Construct a process tree similar to Figure 3.8. To obtain process information for the UNIX
or Linux system, use the command ps -ael.
Use the command man ps to get more information about the ps com-mand. The task manager on
Windows systems does not provide the parent process ID,butthe process monitor tool, available
from [Link], provides a process-tree tool.
3.11 Explain the role of the init process onUNIX and Linux systems in regard to process
termination.
3.12 Including the initial parent process, how many processes are created by the program shown
in Figure 3.32?

3.13 Explain the circumstances under which which the line of code marked printf("LINE J") in
Figure 3.33 will be reached.
3.14 Using the programin Figure 3.34, identify the values of pid at lines A, B, C,and D. (Assume
that the actual pids of the parent and child are 2600 and 2603, respectively.)
3.15 Give an example of a situation inwhich ordinary pipes aremore suitable than named pipes
and an example of a situation in which named pipes are more suitable than ordinary pipes.
3.16 Consider the RPC mechanism. Describe the undesirable consequences that could arise from
not enforcing either the “at most once” or “exactly once” semantic. Describe possible uses for
amechanism that has neither of these guarantees.
3.17 Using the program shown in Figure 3.35, explain what the output will be at lines X and Y.
3.18 What are the benefits and the disadvantages of each of the following? Consider both the
system level and the programmer level.
a. Synchronous and asynchronous communication
b. Automatic and explicit buffering
c. Send by copy and send by reference
d. Fixed-sized and variable-sized messages

Common questions

Powered by AI

After a fork(), parent and child processes share memory segments but not the stack or the heap. The shared segments include those mapped as shared memory, enabling inter-process communication while keeping their individual stacks and heaps separate, which prevents unintended interference between the processes .

In unreliable distributed systems, achieving 'exactly once' RPC execution requires mechanisms like request identifiers, which distinguish unique executions; server-side recording of executed requests and their results; and acknowledgment protocols that ensure a client knows when a request is complete, often supported by retransmission strategies or persistent state storage .

Synchronous communication ensures timely feedback, improving coordination and reducing state inconsistency but can lead to inefficiencies when response times are long. Asynchronous communication enhances scalability and responsiveness by allowing operations to proceed without waiting, but may require complex mechanisms to manage delayed interactions and ensure data consistency .

The output at LINE A in the program shown in Figure 3.30 depends on how the process scheduling occurs and the current state of each process when they reach the print statement. Typically, in programs using fork(), both the parent and child processes can execute, potentially leading to two outputs of the same print statement. Factors such as the operating system's scheduling algorithm, the precise timing of fork() execution, and whether the child or parent completes first will determine the output sequence .

Including the initial parent process, the total number of processes created by executing the program in Figure 3.31 depends on the number of fork() calls made in the program. Each fork() call doubles the number of running processes if executed in an isolated loop. For instance, if two fork() calls are made, 2^2=4 additional processes plus the initial parent (total 5) are created .

In processors like the Sun UltraSPARC with multiple register sets, a context switch is straightforward if the new context is already in a register set: the processor simply begins executing using those registers. However, if the register sets are all in use and the new context is in memory, existing registers must be saved to memory and replaced by the new context's registers, which can introduce latency and overhead, impacting overall system performance .

Concurrent processing adds several challenges to operating systems, including race conditions, where processes compete for shared resources; deadlocks, where two or more processes are waiting indefinitely for resources held by each other; and increased complexity in scheduling and resource management, which require sophisticated algorithms to ensure efficient process execution and communication .

During a context switch, the kernel saves the state of the current process, including its registers and program counter, and loads the state of the next process to execute. This involves updating the CPU's context elements and ensuring memory management resources point to the correct process data, allowing a smooth transition and efficient use of CPU resources .

Short-term scheduling affects process execution during CPU bursts, choosing which processes to execute next; medium-term scheduling involves swapping processes in and out of memory for balancing load and ensuring fair distribution of resources; long-term scheduling controls the admission of jobs into the system to maintain an optimum level of active processes. Each affects system performance and throughput in varying ways .

The loss of an ACK message in an RPC mechanism can challenge 'exactly once' semantics, as the client may not be aware that a procedure was completed, potentially leading it to resend the request. To preserve 'exactly once' semantics, the server must be designed to recognize repeated requests and ensure each is executed only once, typically through unique identifiers or timestamps for requests .

You might also like