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

OS - Week3 - Recitation2 - Answers For TA

OS_week3_recitation2_answers for TA
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)
24 views6 pages

OS - Week3 - Recitation2 - Answers For TA

OS_week3_recitation2_answers for TA
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
You are on page 1/ 6

Answers - Week3_recitation2_4LastID_name

OS: chap3,4_Process,Threads

1. Multiple-choice questions (choose only one answer)


Only one of these options is in line with the question, please fill in its answer in the table below.
There are no points for wrong selection, multiple selection or no selection in the table below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

1) One step in the procedure for creating a new process involves:( )


A.Allocating space for the process
B.Assigning a unique identifier
C.Initializing the process control block
D.All of the above

2) The basic Two-State Process Model defines two possible states for a process in relationship to
the processor:( )
A.Executing and Waiting
B.Running and Executing
C.Running and Not Running
D.None of the above

3) There are a number of conditions that may lead to process termination, including:( )
A.Normal completion
B.Bounds violation
C.Parent termination
D.All of the above

4) In the Five-State Process Model, the following represents a valid state transition:( )
A.All of the above
B.New -> Blocked
C.New -> Running
D.Running -> Blocked

5) In a Process Model that implements two suspend states, a valid state transition is represented
by:( )
A.Ready -> Ready/Suspend
B.Ready/Suspend -> Ready
C.All of the above
D.Running -> Ready/Suspend
6) The Process Image element that contains the collection of attributes needed by the O/S to
control a particular process is called the:( )
A.Process Control Block
B.User Data
C.System Stack
None of the above

7)The processor execution mode that user programs typically execute in is referred to as:( )
A.Kernel mode
B.User mode
C.System mode
D.None of the above

8) About the CPU mode switch and process switch, which one is correct? ( )
I. When the CPU mode switch happens, the process switch must happen too.
II.When the process switch happens, the CPU mode switch must happen too.
III. the CPU mode switch is much more complex than process switch.
A.I
B.II
C.II and III
D.I and III

9)A process switch may occur when the system encounters an interrupt condition, such as that
generated by a:( )
A.System call
B.Trap
C.Memory fault
D.All of the above

10)As for the module of process, which system call usually be provided for the application
development? ( )
I. create a new process;
II. terminate a process;
III. make the running process change into block state;
A.I
B.I,II
C.II, and III
D.All of them

11)As for the term thread, which is NOT correct: ( )


A.It can be considered as a lightweight process
B.It is an execution path within a process
C.All threads within a process share just one PCB
D.Windows’s thread is implemented as ULT
12)Which of the following is the key benefit of threads mode? ( )
A.It takes far less time to create a new thread
B.It takes less time to switch between two threads
C.It enhances efficiency in communication between different executing paths
D.All of the above

13)Which of the following is true regarding the relationship between processes and threads:( )
A.It takes less time to create a new thread in an existing process than create a new process
B.It takes less time to switch between 2 different processes than switch between 2 threads
within the same process
C.It takes less time to terminate a process than a thread
D.All of the above

14)One of the disadvantages of User-Level Threads (ULTs) compared to Kernel-Level Threads (KLT
s) is: ( )
A.When a ULT executes a block system call, all threads in the process are blocked
B.Thread switching does not require kernel mode privileges
C.Scheduling is application specific
D.All of the above

15)Which of the following is not a valid process state in the Five-State Process Model?
A) Ready
B) Suspended
C) Running
D) Exit

2. Open-Ended Questions

1)Moving a process from Running to another state (Ready, Blocked, etc.), requires some steps.
What are those steps? (use your own words to summarize each step into a short phrase.)

Answers:
1 Save the current context
2 Update the process control block (PCB)
3 Queue the PCB in the appropriate list
4 Select another process for execution
5 Update the new process's PCB
6 Update memory management
7 Restore the context

TA’s Reference:
2)What’s the differences between processes and threads? (use any short metaphor that suits you
well to illustrate)

TA’s Reference:
This metaphor helps visualize how threads are lightweight and work within the same
process.
processes as tasks and threads as mini-tasks......
processed as whole cars and threads as passengers inside the car......

3)Draw the fig(s) on Five-state process model by yourself (either by hand, or by software, such as
powerpoint,etc).

Answers:
4)Give short descriptions with your own words on Five-state process model to illustrate each of
the following:
A) The meaning of each node
B) The meaning of each line with arrow

Answers and TA’s references:


A)
Running: The process that is currently being executed. For this chapter, we will assume a
computer with a single processor, so at most one process at a time can be in this state.
Ready: A process that is prepared to execute when given the opportunity.
Blocked/Waiting: 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 OS. Typically, a new process has not yet been loaded into main
memory, although its process control block has been created.
Exit: A process that has been released from the pool of executable processes by the OS,
either because it halted or because it aborted for some reason.
B)
Null → New: A new process is created to execute a program. This event occurs for any of
the reasons listed in Table 3.1.
New → Ready: The OS will move a process from the New state to the Ready state when it is
prepared to take on an additional process......
Ready → Running: When it is time to select a process to run, the OS chooses one of the
processes in the Ready state. This is the job of the scheduler or dispatcher.
Running → Exit: The currently running process is terminated by the OS if the process
indicates that it has completed or if it aborts. See Table 3.2 (Reasons for Process Termination).
Running → Ready: The most common reason for this transition is that the running process
has reached the maximum allowable time for uninterrupted execution; virtually all multi-
programming operating systems impose this type of time discipline......
Running → Blocked: A process is put in the Blocked state if it requests something for which
it must wait. A request to the OS is usually in the form of a system service call......
Blocked → Ready: A process in the Blocked state is moved to the Ready state when the
event for which it has been waiting occurs.
Ready → Exit: For clarity, this transition is not shown on the state diagram. In some systems,
a parent may terminate a child process at any time. Also, if a parent terminates, all child
processes associated with that parent may be terminated.
Blocked → Exit: The comments under the preceding item apply.

You might also like