COMP 346 Study Guide - Final Guide: Call Stack, Program Counter, Logical Address

520 views16 pages
Operating systems Review questions - solutions comp346
Department of computer science Page 1 of 16 Fall 2016
I.Introduction to operating systems.
1. The first INTEL family of CPUs (e.g. 8086/8088) did not include a hardware mode
bit, and consequently both the operating system (e.g. DOS) and the user programs
were executing in the same operational mode.
(a) Explain a problem that could occur because of the missing hardware mode bit.
A user program could accidentally or intentionally access the operating system
resources without restriction. Consequently, a possible fatal crash of the operating
system could occur.
(b) Would it be possible for the operating system to implement a software mode bit in
order to overcome that problem? Explain.
The hardware mode bit is used mostly to restrict access to some CPU resources (e.g.
instructions, registers,...) by the user programs. Access to restricted CPU resources
could possibly allow a program to alter other resources. For instance, an instruction
could change the timer value, an instruction could allow to directly access a
peripheral device, or access to the base register could change an address space.
A software mode bit should work similarly to a hardware mode bit, and should allow a
user program to access only a permitted set of CPU resources. The implementation of
the software mode bit would require the operating system to validate each CPU
operation in order to check that it is legal in the context. Such implementation is not
very suitable because it imposes too much overhead to achieve and consequently
would reduce greatly the overall system performance.
2. Most modern operating systems implement a micro-kernel that contains less
components than a conventional kernel. The kernel components that are not part of
the micro-kernel have been moved to user space.
Explain an advantage of the use of a micro-kernel instead of a conventional kernel.
- A micro-kernel is smaller and thus requires less system resources and can be more
reliable.
II.Process management.
1. Explain which fields in the following process descriptor would not be required in a
thread descriptor.
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 16 pages and 3 million more documents.

Already have an account? Log in
Operating systems Review questions - solutions comp346
Department of computer science Page 2 of 16 Fall 2016
Field
Description
Process identification
An integer number to identify the process.
Process state
The current state of the process.
Owner
The identification of the user that created the process.
Parent process descriptor
A pointer to the descriptor of the parent of the process.
List of child process
descriptors
A pointer to the list of processes that have been created by
the process.
List of reusable and
consumable resources
A pointer to the list of different resources allocated to the
process, and for each resource the number of units allocated
is accounted.
List of file descriptors
A pointer to the list of files that have been open by the
process.
Message queue
A pointer to the message queue of the process.
Protection domain
A description of the access rights held by the process.
Processor registers
content
The content of the program counter, status, base, limit and
relocation registers for a process when it exited the running
state for the last time.
General registers content
The content of the general registers for a process when it
exited the running state for the last time.
Accounting information
A record of any statistical information about the process.
Scheduling information
A record of any information needed to schedule the process
(e.g. priority, pointer to the scheduling queue, …).
Stack pointer
A pointer to the stack allocated to the process.
Process identification.
- A thread also needs to be uniquely identified like a process.
Process state.
- A thread can also be in different states but its number of states is limited compared
to the process.
Owner.
- The owner of a thread is by the default the owner of its controlling process, and
consequently that field is only present in a process descriptor.
Parent process descriptor.
- The parent of a thread is by the default the parent of its controlling process, and
consequently that field is only present in a process descriptor.
- Alternately, a thread descriptor could use that field to identify its controlling
process.
Child process descriptors.
- As a thread can not create other threads or processes, that field is not required.
List of resources.
- As a thread is sharing most of the resources of its controlling process, that field is
not required.
List of file descriptors.
- As a thread is sharing most of the open files of its controlling process, that field is
not required.
Message queue.
- Messages are software resources that are handled by the controlling process but
shared by the thread.
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 16 pages and 3 million more documents.

Already have an account? Log in
Operating systems Review questions - solutions comp346
Department of computer science Page 3 of 16 Fall 2016
Protection domain.
- A protection domain applies to a set of resources that are shared by the threads of
a controlling process.
Processor registers.
- A thread has a context that is different than the context of the controlling process,
and therefore the processor registers are required.
General registers.
- A thread has a context that is different than the context of the controlling process,
and therefore the general registers are required.
Accounting information.
- It may be required to maintain a few statistics about a thread.
Scheduling information.
- A thread may be scheduled differently than its controlling process, and therefore
the scheduling information is required.
Stack pointer.
- A thread needs to have a stack to store its local variables.
2. Consider a process manager that implements both processes and threads. The process
represents the framework and the threads are used solely to execute the instructions.
Among the following list of states, explain which should be more appropriate for a
thread and for a process.
(i) New.
A thread and a process need to be created and therefore this state applies to both.
(ii) Terminated.
A thread and a process need to be terminated and therefore this state applies to both.
(iii) Running.
Only a thread can be set in execution and therefore this state only applies to threads.
(iv) Ready.
Only a thread can be waiting to move into the execution state and therefore this state
only applies to threads.
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 16 pages and 3 million more documents.

Already have an account? Log in