Professional Documents
Culture Documents
Operating System Concepts Important For Exit Exam Questions
Operating System Concepts Important For Exit Exam Questions
Operating System Concepts Important For Exit Exam Questions
System
Concepts
Author: Mohammed Nebil
Computer Science
Unit 1: Computer System
Processor: Controls the operation of the computer and performs its data processing
functions. When there is only one processor, it is often referred to as the central
processing unit (CPU).
Main memory: Stores data and programs. This memory is typically volatile; that is,
when the computer is shut down, the contents of the memory are lost. Main memory
is also referred to as real memory or primary memory.
I/O modules: Move data between the computer and its external environment. The
external environment consists of a variety of devices, including secondary memory
devices.
System bus: Provides for communication among processors, main memory, and I/O
modules.
Instruction Execution:
The two steps are referred to as the fetch stage and the execute stage.
Data processing: The processor may perform some arithmetic or logic operation on
data.
Control: An instruction may specify that the sequence of execution be altered. For
example, the processor may fetch an instruction
System software: is the set of programs that control the activities and functions of
the various hardware components, programming tools and abstractions, and other
utilities to monitor the state of the computer system.
Application software: are the user programs and consists of those programs that
solve specific problems for the users and execute under the control of the operating
system.
Users and application programmers can communicate with an operating system through
its interfaces. There are three general levels of interfaces provided by an operating
system:
1. The highest level is the graphical user interface (GUI), which allows I/O interaction
with a user through intuitive icons, menus, and other graphical objects.
2. The second level of interface, the command line interpreter, or shell, is a text-oriented
interface. Advanced users and application programmers will normally directly
communicate with the operating system at this level.
3. The third level, the system-call interface, is used by the application programs to
request the various services provided by the operating system by invoking or calling
system functions.
Interrupt: is a signal that gets the attention of the CPU and is usually generated when
I/O is required. For example, hardware interrupts are generated when a key is pressed or
when the mouse is moved.
Problems in Concurrency:
Sharing global resources safely is difficult;
Optimal allocation of resources is difficult;
Locating programming errors can be difficult, because the contexts in which errors
occur cannot always be reproduced easily.
Resident monitor: this is a system that loads the program into the computer, reading
it from a tape or punched cards.
Multi-programming: In this technique, the main memory already holds more than
one program, and the operating system is responsible for allocating the machine’s
resources to execute tasks based on existing needs.
Timeshare: This is a system that assigns the execution of applications within a group
of users working online.
Multiprocessor: these are systems that try to manage the readings and writings made
in memory by two programs that are running simultaneously, in order to avoid errors.
Monolithic system: In this approach the entire operating system runs as a single
program in kernel mode.
The services (system calls): provided by the operating system are requested by
putting the parameters in a well-defined place (e.g., on the stack) and then executing
a trap instruction.
A distinction is made in the literature between spatial locality and temporal locality.
Temporal locality: refers to the tendency for a processor to access memory locations
that have been used recently.
An OS is a program that controls the execution of application programs and acts as
an interface between applications and the computer hardware.
Access to I/O devices: Each I/O device requires its own peculiar set of instructions
or control signals for operation.
Controlled access to files: For file access, the OS must reflect a detailed
understanding of not only the nature of the I/O device (disk drive, tape drive) but also
the structure of the data contained in the files on the storage medium.
System access: For shared or public systems, the OS controls access to the system as
a whole and to specific system resources.
Error detection and response: A variety of errors can occur while a computer
system is running.
Accounting: A good OS will collect usage statistics for various resources and
monitor performance parameters such as response time.
Instruction set architecture (ISA): The ISA defines the repertoire of machine
language instructions that a computer can follow.
Application binary interface (ABI): The ABI defines a standard for binary
portability across programs.
Application programming interface (API): The API gives a program access to the
hardware resources and services available in a system through the user ISA
supplemented with high-level language (HLL) library calls.
Process States
The process manager controls execution of the various processes in the system.
Processes change from one state to another during their lifetime in the system
A state diagram represents the various states of a process and the possible transitions
in the behavior of a process.
Setup time: A single program, called a job, could involve loading the compiler plus
the high-level language program (source program) into memory, saving the compiled
program (object program) and then loading and linking together the object program
and common functions.
A user program executes in a user mode, in which certain areas of memory are
protected from the user’s use and in which certain instructions may not be executed.
The monitor executes in a system mode, or what has come to be called kernel mode,
in which privileged instructions may be executed and in which protected areas of
memory may be accessed.
A state diagram represents the various states of a process and the possible transitions
in the behavior of a process.
For every new process in the system, a data structure called the process descriptor,
also known as a process control block (PCB).
A process descriptor represents a process in the system and when the process
terminates, its descriptor is normally destroyed.
The time it takes for this changeover is called the context switch time.
Deadlocks: It is possible for two or more programs to be hung up waiting for each
other.
The execution context , or process state , is the internal data by which the OS is
able to supervise and control the process.
When the OS interrupts an executing process, it carries out a context switch the
changing of the CPU from one process to another.
The time it takes for this changeover is called the context switch time.
Deadlocks
Deadlock is the state of indefinite waiting that processes may reach when competing
for system resources or when attempting to communicate.
There are four conditions that are necessary for existence of deadlock:
Synchronization
When two or more processes execute and independently attempt to simultaneously share
the same resources, their executions generally will not produce correct results.
To solve the race condition problem when a group of processes are competing to use a
resource, only one process must be allowed to access the shared resource at a time. When
one process is using a shared resource, any other process that needs access to that
resource is excluded from using it at the same time. This condition is called mutual
exclusion. At any given time, only one process is allowed to access a shared resource; all
other processes must wait.
The part or segment of code in a process that accesses and uses a shared resource is
called the critical section. If the two vehicles reach the intersection at the same time,
there will be a collision, which is an undesirable event. The road intersection is critical
for both roads because it is part of Road A and also part of Road B, but only one vehicle
should enter the intersection at any given time.
Process Concepts
When the OS creates a process at the explicit request of another process, the action is
referred to as process spawning.
When one process spawns another, the former is referred to as the parent process,
and the spawned process is referred to as the child process.
Spawn: Typically, when a new process is spawned, a thread for that process is also
spawned. Subsequently, a thread within a process may spawn another thread within
the same process, providing an instruction pointer and arguments for the new thread.
Block: When a thread needs to wait for an event, it will block (saving its user
registers, program counter, and stack pointers).
Unblock: When the event for which a thread is blocked occurs, the thread is moved
to the Ready queue.
Finish: When a thread completes, its register context and stacks are deallocated.
The way to overcome the problem of blocking threads is to use a technique referred
to as jacketing, the purpose of jacketing is to convert a blocking system call into a
nonblocking system call.
A section of code within a process that requires access to shared resources and that
must not be executed while another process is in a corresponding section of code is
called critical section.
A situation in which two or more processes are unable to proceed because each is
waiting for one of the others to do something is called deadlock.
A situation in which multiple threads or processes read and write a shared data item
and the final result depends on the relative timing of their execution is called race
condition.
A compare is made between a memory value and a test value; if the memory value
and test value are the same, a swap occurs.
A semaphore that takes on only the values 0 and 1 is called binary semaphore.
The process that has been blocked the longest is released from the queue first; a
semaphore whose definition includes this policy is called a strong semaphore.
A semaphore that does not specify the order in which processes are removed from the
queue is a weak semaphore.
Blocking send, blocking receive: Both the sender and receiver are blocked until the
message is delivered; this is sometimes referred to as a rendezvous.
Non-blocking send, blocking receive: Although the sender may continue on, the
receiver is blocked until the requested message arrives. This is probably the most
useful combination. It allows a process to send one or more messages to a variety of
destinations as quickly as possible.
Long-term scheduling: The operating system decides to create a new process from
the jobs waiting in the input queue. This can control degree of multiprogramming.
Medium-term scheduling: The operating system decides when and which process to
swap out or swap in from or to memory. This also control degree of
multiprogramming.
Short-term scheduling: The operating system decides which process to execute next.
In other words, the operating system decides when and to which process the CPU
will be allocated next.
CPU Scheduler
CPU utilization: The proportion of time that the CPU spends executing processes.
Throughput: The total number of processes that are executed and completed during
some observation periods.
Process average waiting time: The average of the waiting intervals of all processes
that are completed.
Average turnaround time: The average of the intervals from arrival until
completion, for all processes.
Average response time: The average of the intervals from the time a process sends a
command or request to the operating system until a response is received, for all
processes. This metric is used mainly in interactive systems.
Fairness: A metric that indicates if all processes are treated in a similar manner. The
normalized turnaround time is often used for this purpose.
Shortest job first (SJF): The process with the shortest CPU burst is the one selected
next from the ready queue. It is non-preemptive scheduling.
Longest job first (L JF): The process with the longest CPU burst is selected next
from the ready queue.
Priority scheduling: A priority is assigned to each type of process. The process with
the highest priority is the one selected next. Either preemptive or non-preemptive
scheduling.
Round robin (RR): Processes are basically selected in the same order of arrival to
the ready queue but can only execute until the time slice expires. It is preemptive
scheduling.
Shortest remaining time (SRT): also known as shortest remaining time first (SRTF):
A new process that arrives will cause the scheduler to interrupt the currently
executing process if the CPU service period of the newly arrived process is less than
the remaining service period of the process currently executing (receiving CPU
service). It is preemptive scheduling.
Access time: Which is the time it takes to get into position to read or write.
THANK YOU!
IT IS IMPORTANT FOR EXIT EXAM QUESTIONS