0% found this document useful (0 votes)
420 views7 pages

Sheet3 Solution

The document discusses process description and control in operating systems. It covers topics like process states, process scheduling, and process management. There are true/false and multiple choice questions related to these topics, as well as fill-in-the-blank questions about process terms.

Uploaded by

inosta11111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
420 views7 pages

Sheet3 Solution

The document discusses process description and control in operating systems. It covers topics like process states, process scheduling, and process management. There are true/false and multiple choice questions related to these topics, as well as fill-in-the-blank questions about process terms.

Uploaded by

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

Operating Systems, sheet-2 Chapter 3 – Process Description and Control

True / False Questions:


1. The principal function of the processor is to execute machine instructions residing in main memory.
(T)
2. A process trace is a listing of the sequence of instructions that execute for that process. (T)
3. The principal responsibility of the operating system is to control the execution of processes. (T)
4. When one process spawns another, the spawning process is referred to as the child process and the
spawned process is referred to as the parent process. (F) opposite is true
5. Round-Robin processing refers to a method of thread prioritization for scheduling. (F) not prioritized
6. The primary difference between the Two-State Process Model and the Five-State Process Model is
that the latter splits the Running state into two new states: Ready and Blocked.
(F) splits the not running state
7. One solution to the problem of limited main memory space is swapping, which involves moving all
or part of a process from main memory to secondary memory. (T)
8. In order to define the control structures (e.g., tables) that the O/S needs to manage processes and
resources, it must have access to configuration data during initialization. (T)
9. The Process Image refers to the binary form of the program code.
(F) refers to process elements : program , data , stack and attributes
10. The portion of the Process Control Block that consists of the contents of the processor registers is
called the Process Control Information.
(F) processor state information portion of the PCB contains registers
11. The less-privileged processor execution mode is often referred to as kernel mode. (F) user mode
12. The primary process table contains one entry per process, unless the process spawns a new process, in
which case the table contains multiple entries for the parent process.
(F) only one entry for the parent process
13. One kind of system interrupt, the trap, relates to an error or exception condition in the currently
running process. (T)
14. In the Nonprocess Kernel approach to defining the relationship between the O/S and the User
Process, the O/S code is executed as a separate entity that operates in privileged mode. (T)
15. A typical UNIX system employs two Running states, to indicate whether the process is executing in
user mode or kernel mode. (T)

MCQs:
1. The behavior of a processor can be characterized by examining:
a- A single process trace b- Multiple process traces
c- The interleaving of the process traces d- All of the above
2. The behavior of an individual process can be characterized by examining:
a- A single process trace b- Multiple process traces
c- The interleaving of the process traces d-All of the above
3. The basic Two-State Process Model defines two possible states for a process in relationship to the
processor: a- Running and Executing b-Running and Not Running
c- Executing and Waiting d-None of the above
4. There are a number of conditions that can lead to process termination, including:
a- Normal completion b- Bounds violation c- Parent termination d- All of the above
5. In the Five-State Process Model, the following represents a valid state transition:
a- Running -> Blocked b- New -> Running c-New -> Blocked d- All of the above
6. In a Process Model that implements two suspend states, a valid state transition is represented by:
a- Ready/Suspend -> Ready b- Running -> Ready/Suspend
c-Ready -> Ready/Suspend d-All of the above
7. The scheduling strategy where each process in the queue is given a certain amount of time, in turn, to
execute and then returned to the queue, unless blocked is referred to as:
a- Prioritization b- Round-Robin c- LIFO d- All of the above

Page 1 of 7
Operating Systems, sheet-2 Chapter 3 – Process Description and Control

8. A Memory Table is an O/S control structure that is used by the O/S to:
a- Manage I/O devices b-Manage processes
c- Provide information about system files d-None of the above
9. The Process Image element that contains the collection of attributes needed by the O/S to control a
particular process is called the:
a- User Data b- System Stack c- Process Control Block d- None of the above
10. The Process Image element that contains the modifiable part of the user space is called the:
a- User Program b- System Stack c-Process Control Block d-None of the above
11. The processor execution mode that user programs typically execute in is referred to as:
a- User mode b- System mode c-Kernel mode d- None of the above
12. One step in the procedure for creating a new process involves:
a- Initializing the process control block b- Allocating space for the process
c- Assigning a unique identifier d- All of the above
13. A process switch may occur when the system encounters an interrupt condition, such as that
generated by a:
a- Memory fault b- Supervisor call c- Trap d- All of the above
14. In the Process Based O/S:
a- Major kernel functions are organized as separate functions
b- The User Process Image includes a kernel stack
c- O/S code and data are contained in the shared address space d- None of the above
15. In a typical UNIX system, the element of the process image that contains the processor status
information is the:
a- System-level context b- Register context c- User-level context d- All of the above

Fill-In-The-Blank Questions:
1. The listing of a sequence of instructions that execute for a particular process is called a
_____trace______.
2. The behavior of a processor can be characterized by examining the interleaving of the process
______traces______ for the processes currently running on the system.
3. The portion of the operating system that selects the next process to run is called the
_____dispatcher________.
4. When the O/S creates a process at the explicit request of an existing process, the action is referred to
as __________process spawning_____________.
5. A process that cannot execute until some event occurs is said to be in the _____blocked__________
state.
6. In a system that implements two suspend states, a process that has been swapped out of main memory
and into secondary memory and that is also awaiting an event is in the
____blocked____/____suspend____ state.
7. The scheduling strategy where each process in the queue is given a certain amount of time, in turn, to
execute and then returned to the queue, unless blocked is referred to as
_______round-robin________.
8. The O/S control structure that the O/S uses to manage system processes is called the
____process table________.
9. The User Data, User Program, System Stack and Process Control Block elements collectively make
up what is referred to as the _______process image___________.
10. The Process Identification, Processor State Information and the Process Control Information are the
general categories that collectively make up what is referred to as the
________process control block_________.
11. The processor typically maintains the current operating mode (i.e., user or kernel) in the
_____program status word (PSW)_____.

Page 2 of 7
Operating Systems, sheet-2 Chapter 3 – Process Description and Control

12. The first step in creating a new process is to assign a unique _______ program identifier _________
to the new process.
13. The execution of a user process may be interrupted by a _______supervisor call___________, which
might be generated by the process requesting an I/O operation.
14. In the _______separate kernel___________ model for illustrating the relationship between the O/S
and User Processes, the O/S has its own region of memory to use and its own system stack for
controlling procedure calls and returns.
15. In the ________short-term__________ model for illustrating the relationship between the O/S and
User Processes, the O/S has its own region of memory to use and its own system stack for controlling
procedure calls and returns.
16. Process creation in a typical UNIX system is made by means of a kernel system call named
___fork()____.

Q2 Review questions
3.1 What is an instruction trace?
An instruction trace for a program is the sequence of instructions that execute for
that process.
3.2 What common events lead to the creation of a process?
New batch job; interactive logon; created by OS to provide a service; spawned by
existing process. See Table 3.1 for details
3.3 For the processing model of Figure 3.6 , briefly define each state.
Running:The process that is currently being executed. Ready:A process that is
prepared to execute when given the opportunity. Blocked:A process that cannot
execute until some event occurs, such as the completion of an I/O operation. New:
A process that has just been created but has not yet been admitted to the pool of
executable processes by the operating system.
Exit:A process that has been released
from the pool of executable processes by the operating system, either because it
halted or because it aborted for some reason.
3.4 What does it mean to preempt a process?
Process preemption occurs when an executing process is interrupted by the
processor so that another process can be executed
3.5 What is swapping and what is its purpose?
Swapping involves moving part or all of a process from main memory to disk.
When none of the processes in main memory is in the Ready state, the operating
system swaps one of the blocked processes out onto disk into a suspend queue, so
that another process may be brought into main memory to execute
3.6 Why does Figure 3.9b have two blocked states?
There are two independent concepts: whether a process is waiting on an event

Page 3 of 7
Operating Systems, sheet-2 Chapter 3 – Process Description and Control

(blocked or not), and whether a process has been swapped out of main memory
(suspended or not). To accommodate this 2 × 2 combination, we need two Ready
states and two Blocked states.
3.7 List four characteristics of a suspended process.
1.The process is not immediately available for execution. 2.The process may or
may not be waiting on an event. If it is, this blocked condition is independent of
the
suspend condition, and occurrence of the blocking event does not enable the
process to be executed. 3.The process was placed in a suspended state by an agent;
either itself, a parent process, or the operating system, for the purpose of
preventing its execution. 4.The process may not be removed from this state until
the agent explicitly orders the removal.
3.8 For what types of entities does the OS maintain tables of information for
management
purposes?
The OS maintains tables for entities related to memory, I/O, files, and processes.
See Table 3.10 for details.
3.9 List three general categories of information in a process control block.
Process identification, processor state information, and process control
information.
3.10 Why are two modes (user and kernel) needed?
The user mode has restrictions on the instructions that can be executed and the
memory areas that can be accessed. This is to protect the operating system from
damage or alteration. In kernel mode, the operating system does not have these
restrictions, so that it can perform its tasks.
3.11 What are the steps performed by an OS to create a new process?
1. Assign a unique process identifier to the new process.
2. Allocate space for the process.
3. Initialize the process control block.
4. Set the appropriate linkages.
5. Create or expand other data structures.

3.12 What is the difference between an interrupt and a trap?


An interrupt is due to some sort of event that is external to and independent of the
currently running process, such as the completion of an I/O operation. A trap
relates to an error or exception condition generated within the currently running
process, such as an illegal file access attempt.
3.13 Give three examples of an interrupt.
Clock interrupt, I/O interrupt, memory fault
3.14 What is the difference between a mode switch and a process switch?

Page 4 of 7
Operating Systems, sheet-2 Chapter 3 – Process Description and Control

A mode switch may occur without changing the state of the process that is
currently in the Running state. A process switch involves taking the currently
executing process out of the Running state in favor of another process. The process
switch involves saving more state information.

Q3 Problems
3.1 The following state transition table is a simplified model of process
management, with
the labels representing transitions between states of READY, RUN, BLOCKED,
and
NONRESIDENT.

Give an example of an event that can cause each of the above transitions. Draw a
diagram if that helps.
•Creation and deletion of both user and system processes.The processes in the
system can execute concurrently for information sharing, computation speedup,
modularity, and convenience. Concurrent execution requires a mechanism for
process creation and deletion. The required resources are given to the process
when it is created, or allocated to it while it is running. When the process
terminates, the OS needs to reclaim any reusable resources.
•Suspension and resumption of processes.In process scheduling, the OS needs to
change the process's state to waiting or ready state when it is waiting for some
resources. When the required resources are available, OS needs to change its
state to running state to resume its execution.
•Provision of mechanism for process synchronization.Cooperating processes
may share data. Concurrent access to shared data may result in data
inconsistency. OS has to provide mechanisms for processes synchronization to
ensure the orderly execution of cooperating processes, so that data consistency is
maintained.
•Provision of mechanism for process communication.The processes executing

Page 5 of 7
Operating Systems, sheet-2 Chapter 3 – Process Description and Control

under the OS may be either independent processes or cooperating processes.


Cooperating processes must have the means to communicate with each other.
•Provision of mechanisms for deadlock handling.In a multiprogramming
environment, several processes may compete for a finite number of resources. If
a deadlock occurs, all waiting processes will never change their waiting state to
running state again, resources are wasted and jobs will never be completed.
3.2 Assume that at time 5 no system resources are being used except for the
processor
and memory. Now consider the following events:
At time 5: P1 executes a command to read from disk unit 3.
At time 15: P5’s time slice expires.
At time 18: P7 executes a command to write to disk unit 3.
At time 20: P3 executes a command to read from disk unit 2.
At time 24: P5 executes a command to write to disk unit 3.
At time 28: P5 is swapped out.
At time 33: An interrupt occurs from disk unit 2: P3’s read is complete.
At time 36: An interrupt occurs from disk unit 3: P1’s read is complete.
At time 38: P8 terminates.
At time 40: An interrupt occurs from disk unit 3: P5’s write is complete.
At time 44: P5 is swapped back in.
At time 48: An interrupt occurs from disk unit 3: P7’s write is complete.
For each time 22, 37, and 47, identify which state each process is in. If a process is
blocked, further identify the event on which is it blocked.
The following example is used in [PINK89] to clarify their definition of block and
suspend:
Suppose a process has been executing for a while and needs an additional
magnetic tape drive so that it can write out a temporary file. Before it can
initiate a write to tape, it must be given permission to use one of the drives.
When it makes its request, a tape drive may not be available, and if that is the
-16-case, the process will be placed in the blocked state. At some point, we assume
the system will allocate the tape drive to the process; at that time the process
will be moved back to the active state. When the process is placed into the
execute state again it will request a write operation to its newly acquired tape
drive. At this point, the process will be move to the suspend state, where it
waits for the completion of the current write on the tape drive that it now
owns.
The distinction made between two different reasons for waiting for a device could
be useful to the operating system in organizing its work. However, it is no
substitute for a knowledge of which processes are swapped out and which

Page 6 of 7
Operating Systems, sheet-2 Chapter 3 – Process Description and Control

processes are swapped in. This latter distinction is a necessity and must be
reflected
in some fashion in the process state.
3.3 Figure 3.9b contains seven states. In principle, one could draw a transition
between
any two states, for a total of 42 different transitions.
a. List all of the possible transitions and give an example of what could cause each
transition.
b. List all of the impossible transitions and explain why.
Figure 9.3 shows the result for a single blocked queue. The figure readily
generalizes to multiple blocked queues.
‫☺فى المرجع‬
3.4 For the seven-state process model of Figure 3.9b , draw a queueing diagram
similar to
that of Figure 3.8b .

Penalize the Ready, suspend processes by some fixed amount, such as one or two
priority levels, so that a Ready, suspend process is chosen next only if it has a
higher priority than the highest-priority Ready process by several levels of priority.

Page 7 of 7

You might also like