You are on page 1of 61

OS Midterm Revision 2023 by Eng Ihap EL-Galaly

Part 1 Essay Question


What Operating Systems Do?
 An operating system (OS) is software that manages a computer’s hardware, and
 A program that acts as an intermediary between a user of a computer and the computer
hardware.
 An operating system simply provides an environment within which other programs can
do useful work.

List three of OS Goal?


• Execute user programs and make solving user problems easier.
• Make the computer system convenient to use.
• Use the computer hardware in an efficient manner.

Describe the Structure computer System?


• Hardware – provides the basic computing resources for the system: Central Processing
Unit (CPU), memory, Input/Output (I/O) devices.
• Operating system: Controls the hardware and coordinates its use among the various
application programs for the various users.
• Application programs – define the ways in which the system resources are used to solve
the computing problems of the users:
• Users : People, machines, other computers.

Draw Dynamic View of System Components?

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 1


What Operating Systems Do (Top Down View)?
 User view: The user’s view of the computer varies according to the interface being used.
• Users want convenience, ease of use and good performance.
• They don’t care about resource utilization (how h/w & s/w are shared).
 Shared computer such as mainframe must keep all users happy.
 Mobile devices like smartphones and tablets are resource poor, optimized for usability
and battery life.
 Some computers have little or no user interface, such as embedded computers in home
devices and automobiles.

What Operating Systems Do (Bottom Up View)?


 System view: From the computer’s point of view, the operating system is the program
most intimately involved with the hardware.
 OS is a resource allocator making efficient use of hardware (HW):
• A computer system has many resources: CPU time, memory space, storage space, I/O
devices, and so on.
• There are numerous and possibly conflicting requests for resources.
• The operating system acts as the manager of the computer resources. It must decide how
to allocate resources to specific programs and users so that it can operate the computer
system efficiently and fairly.
 OS is a control program for managing execution of user programs and controlling the
various I/O devices to prevent errors and improper use of the computer.

When interacting with a device controller, the CPU can wait for a response by
polling describe it?
 Problem with polling: The CPU is busy waiting for some event to happen. CPU utilization
will be low.
 Solution: Interrupts.
 Device controller informs CPU that it has finished its operation by causing an interrupt

List and explain why An operating system is interrupt driven.?


• If there are no processes to execute, no I/O devices to service, and no users to whom to
respond, an operating system will sit quietly, waiting for something to happen.
• Events are almost always signaled by the occurrence of an interrupt.
 A trap (or exception) is a software-generated interrupt caused either by:
• An error (for example, division by zero or invalid memory access), or
• A specific request from a user program that an operatingsystem service be performed by
executing a special operation called a system call.

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 2


Describe Direct Memory Access (DMA)?
 CPU utilization can be improved even further by allowing a device controller to transfer
data from/to main memory without any involvement of the CPU.
 This is called direct memory access and is used by all modern hard drives (but also sound
controllers, network cards, etc.).
 The CPU initiates the data transfer, but can do other things while the transfer is taking
place. CPU utilization is increased.

Why The programs and data cannot reside in main memory?


• Main memory is usually too small to store all needed programs and data permanently.
• Main memory is volatile—it loses its contents when power is turned off.

What is meaning of Computer-System Architecture?


 A computer system can be categorized roughly according to the number of general-
purpose processors used:
• Single-Processor Systems.
• Multiprocessor Systems.
• Clustered Systems.

List and explain Advantages of Multiprocessor Systems?


1.Increased throughput: By increasing the number of processors, we expect to get more
work done in less time
2. Economy of scale: Multiprocessor systems can cost less than equivalent multiple single-
processor systems, because they can share peripherals, mass storage, and power supplies.
3. Increased reliability: graceful degradation or fault tolerance (i.e. the failure of one
processor will not halt the whole system

What are the types of Multiprocessor Systems?


 Asymmetric Multiprocessing: each processor is assigned a specific task.
• A master–slave relationship.
• A master processor controls the system: schedules and allocates work to the slave
processors.
• The other processors either look to the master for instruction or have predefined
tasks.
 Symmetric Multiprocessing (SMP): each processor performs all tasks (including OS
functions and user processes).
• The most common systems.
• All processors are peers; no master–slave relationship exists between processors

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 3


Take about Dual-Core Design?
A dual-core design with two cores on the same processor chip:
• Each core has its own register set, as well as its own local cache, often known as a level 1,
or L1, cache.
• A level 2 (L2) cache is local to the chip but is shared by the two processing cores.

What are the Advantages of Clustered Systems?


• Provides a high-availability service which survives failures. The service will continue even
if one or more systems in the cluster fail.
• High availability provides increased reliability, which is crucial in many applications.

What are the types of Clustered Systems?


 Asymmetric Clustering:
• One machine is in hot-standby mode while the other is running the applications.
• The hot-standby host machine does nothing but monitor the active server. If that
server fails, the hot-standby host becomes the active server.
 Symmetric Clustering:
• Two or more hosts (nodes) are running applications and are monitoring each other.
• Advantage: This structure is obviously more efficient, as it uses all of the available
hardware. However, it does require that more than one application be available to
run.

Explain Non-Uniform Memory Access (NUMA) System and list the Pros and
Cons ?
 CPUs are connected by a shared system interconnect, so that all CPUs share one physical
address space.
 The advantage: Fast access of a CPU to its local memory with no contention over the
system interconnect. So, NUMA systems can scale more effectively as more processors are
added.
 The drawback: Increased latency when a CPU accesses remote memory across the
system interconnect (slowing down performance).

What are the different types of interrupts?


 I/O completion interrupt (by device controllers).
 Timer interrupt.
 Exception.
 System call.

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 4


Explain the role of Bootstrap program?
 Bootstrap program is loaded at power-up or reboot:
• Typically stored in read-only memory (ROM) or Electrically erasable programmable read-
only memory (EPROM)
1. Initializes all aspects of system: From CPU registers to device controllers to memory
contents.
2. Loads operating system kernel and starts execution. Locate the operating-system kernel
and load it into memory. Once the kernel is loaded and executing, it can start providing
services to the system and its users.

Describe the use of the timer?


 We must ensure that the operating system maintains control over the CPU.
 To accomplish this goal, we can use a timer.
 Before turning over control to the user, the operating system ensures that the timer is
set to interrupt.
 Timer to prevent infinite loop (or process hogging resources)
1. Timer is set to interrupt the computer after some time period.
2. Keep a counter that is decremented by the physical clock.
3. When counter zero generate an interrupt.

 Which of the following instructions should be privileged?


a. Set value of timer.
b. Read the clock.
c. Clear memory.
d. Issue a trap instruction.
e. Turn off interrupts.
f. Modify entries in device-status table.
g. Access I/O device.

List the OS Process Management Activities?


• Creating and deleting both user and system processes.
• Scheduling processes and threads on the CPUs.
• Suspending and resuming processes.
• Providing mechanisms for process synchronization.
• Providing mechanisms for process communication.
• Providing mechanisms for deadlock handling.

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 5


List the OS Memory Management Activities?
• Keeping track of which parts of memory are currently being used and which process is
using them.
• Allocating and deallocating memory space as needed.
• Deciding which processes (or parts of processes) and data to move into and out of
memory.

List the OS File-System management?


1. Creating and deleting files and directories.
2. Primitives to manipulate files and directories.
3. Mapping files onto secondary storage.
4. Backup files onto stable (non-volatile) storage media.

List the OS Mass-Storage Management?


• Partitioning.
• Mounting and unmounting.
• Free-space management.
• Storage allocation.
• Disk scheduling: Multiple I/O requests may arrive by different processes and only one I/O
request can be served at a time by the disk controller. Thus other I/O requests need to wait
in the waiting queue and need to be scheduled.
• Protection.

List The I/O subsystem components?


• A memory-management of I/O component that includes buffering (storing data
temporarily while it is being transferred), caching (storing parts of data in faster storage for
performance), and spooling (A spool is a buffer that holds output for a device, such as a
printer, that cannot accept interleaved data streams).
• A general device-driver interface.
• Drivers for specific hardware devices.

Define and give example of protection mechanisms?


Protection – any mechanism for controlling access of processes or users to resources
defined by the OS.
• Memory-addressing hardware ensures that a process can execute only within its own
address space.
• The timer ensures that no process can gain control of the CPU without eventually
relinquishing control.
• Device-control registers are not accessible to users, so the integrity of the various
peripheral devices is protected.

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 6


Define Distributed Systems?
▪ A distributed system is a collection of separate, possibly heterogeneous, computer
systems networked to provide users with access to the various shared resources.
• Access to a shared resource increases computation speed, functionality, data availability,
and reliability.

List Computing Environments?


1. Traditional
2. Mobile
3. Client Server
4. Peer-to-Peer
5. Cloud Computing
6. Real-Time Embedded Systems

What is the functional difference between mobile devices and a “traditional” laptop?
1. Today, mobile systems are used not only for e-mail and web browsing. Extra feature –
more OS features (GPS, accelerometers, and gyroscopes) allow new types of apps like
augmented reality.
2. The memory capacity and processing speed of mobile devices are more limited than
those of PCs.
3. Mobile devices use IEEE 802.11 wireless, or cellular data networks for connectivity.

List the feature and give example of real-time operating systems.?


• A real-time system has well-defined, fixed time constraints.
• Processing must be done within the defined constraints, or the system will fail.
• A real-time system functions correctly only if it returns the correct result within its time
constraints.
▪ Systems that control scientific experiments, medical imaging systems, industrial control
systems, and certain display systems are real-time systems.

List and explain Operating System Services provides functions that are helpful
to the user?
1. User interface - Almost all operating systems have a user interface (UI)
2. Program execution - The system must be able to load a program into memory and to run
that program, end execution, either normally or abnormally
3. I/O operations - A running program may require I/O, which may involve a file or an I/O
device.
4. File-system manipulation - The file system is of particular interest.
5. Communications – Processes may exchange information
6. Error detection – OS needs to be detecting and correcting errors constantly. OS needs to
be constantly aware of possible errors

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 7


Why would an application programmer prefer programming according to an
API rather than invoking actual system calls?
1. Program portability: An application programmer designing a program using an API can
expect her program to compile and run on any system that supports the same API.
2. Actual system calls can often be more detailed and difficult to work with than the API
available to an application programmer.
3. Another important factor in handling system calls is the run-time environment (RTE)—
the full suite of software needed to execute applications written in a given programming
language, including its compilers or interpreters as well as other software, such as libraries
and loaders.

System calls can be grouped into major categories list them ?


1. Process control.
2. File management.
3. Device management.
4. Information maintenance.
5. Communications.
6. Protection.

Define and list System Services?


 System programs (or system utilities) provide a convenient environment for program
development and execution.
 System programs can be divided into:
1. File manipulation.
2. Status information sometimes stored in a file.
3. Programming language support.
4. Program loading and execution.
5. Communications.
6. Background services.
7. Application programs.
8. Application programs

Why Applications are Operating System Specific?


1. Each operating system provides its own unique system calls.
2. Different file formats of executable files for each OS.
3. Apps compiled on one system usually not executable on other OSes.

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 8


Applications can run on multiple operating systems in one of three ways?
1. Written in interpreted language (such as Python and Ruby) and interpreter available on
multiple operating systems.
2. App written in language that includes a virtual machine (VM) containing the running app
(like Java).
3. Use standard language (like C), compile separately on each operating system to run on
each.

List the steps of generating an operating system from scratch:


Write the operating system source code (or obtain previously written source code).
Configure the OS for the system on which it will run. Configuring the system involves
specifying which features will be included.
Compile the operating system.
install the operating system.
Boot the computer and its new operating system.

Define System Boot and define how OS is booting?


 The process of starting a computer by loading the kernel is known as booting the system.
 On most systems, the boot process proceeds as follows: Small piece of code – bootstrap
loader, BIOS, stored in ROM or EEPROM locates the kernel, loads it into memory, and starts
it.

Some computer systems use a multistage boot process list and explain this steps?
• When the computer is first powered on, a small boot loader located in nonvolatile
firmware known as BIOS is run
• This initial boot loader usually does nothing more than load a second boot loader, which
is located at a fixed disk location called the boot block
• The program stored in the boot block may be sophisticated enough to load the entire
operating system into memory and begin its execution.

What is the Advantage of using UEFI?


 Modern systems replace BIOS with Unified Extensible Firmware Interface (UEFI).
UEFI is a single, complete boot manager and therefore is faster than the multistage BIOS
boot process.

What is the advantage and disadvantage of high-level language?


Advantages of using a higher-level language for implementing operating systems: the code
can be written faster, is more compact, and is easier to understand and debug. Besides, the
OS is far easier to port to other hardware.
Disadvantages are reduced speed and increased storage requirements.

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 9


What is the advantage and disadvantage of Monolithic Structure?
 Advantages:
• The apparent simplicity of monolithic kernels.
• Speed and efficiency: Monolithic kernels do have a distinct performance advantage,
however: there is very little overhead in the system-call interface, and communication
within the kernel is fast.
 Disadvantages:
• They are difficult to implement and extend.  This is an enormous amount of functionality
to be combined into one single address space.
• The monolithic approach is often known as a tightly coupled system because changes to
one part of the system can have wide-ranging effects on other parts.

What is the advantage and disadvantage of Layered Approach?


Advantages:
The simplicity of construction and debugging. If an error is found during the debugging of a
particular layer, the error must be on that layer, because the layers below it are already
debugged. Thus, the design and implementation of the system are simplified.
 Disadvantages:
Nevertheless, relatively few operating systems use a pure layered approach.
• One reason involves the challenges of appropriately defining the functionality of each
layer.
• In addition, the overall performance of such systems is poor due to the overhead of
requiring a user program to traverse through multiple layers to obtain an operating-system
service.

What is the advantage and disadvantage of Microkernels approach?


 Advantages:
• Easier to extend a microkernel.
• Easier to port the operating system to new architectures.
• More reliable (less code is running in kernel mode).
• More secure.
 Disadvantages:
• Performance overhead of user space to kernel space communication.

Define PCB?
• Each process is represented in the OS by a process control block (PCB) (also called a task
control block). In brief, the PCB simply serves as the repository for all the data needed to
start, or restart, a process, along with some accounting data.

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 10


Define Process State and list all possible states of the process?
• The state of a process is defined in part by the current activity of that process.
 A process may be in one of the following states:
• New: The process is being created.
• Running: Instructions are being executed.
• Waiting: The process is waiting for some event to occur (such as an I/O completion or
reception of a signal).
• Ready: The process is waiting to be assigned to a processor.
• Terminated: The process has finished execution.

Draw Diagram of Process State?

List the Advantages of Multithreading?


1. Responsiveness. Multithreading an interactive application may allow a program to
continue running even if part of it is blocked or is performing a lengthy operation, thereby
increasing responsiveness to the user.
2. Resource sharing. Threads share the memory and the resources of the process to which
they belong by default.
3. Economy. Allocating memory and resources for process creation is costly. Because
threads share the resources of the process to which they belong, it is more economical to
create and context-switch threads.
4. Scalability. The benefits of multithreading can be even greater in a multiprocessor
architecture, where threads may be running in parallel on different processing cores.

List the Resource sharing options?


1. Parent and children share all resources.
2. Children share subset of parent’s resources.
3. Parent and child share no resources.

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 11


When a process creates a new process, list the execution options?
1. The parent continues to execute concurrently with its children.
2. The parent waits until some or all of its children have terminated.

Why we need cooperating processes?


1. Information sharing: several applications may be interested in the same piece of
information.
2. Computation speedup: In multicore systems, we may break a task (to run faster) into
subtasks, each of which will be executing in parallel with the others.
3. Modularity: A software system is constructed in a modular fashion, dividing the system
functions into separate processes or threads.

There are Two common types of pipes used on both UNIX and Windows
systems?
1. Ordinary pipes – can not be accessed from outside the process that created it. Typically,
a parent process creates a pipe and uses it to communicate with a child process that it
created.
2. Named pipes – can be accessed without a parent-child relationship.

What are the difference between Preemptive and Nonpreemptive Scheduling?


• Under Nonpreemptive scheduling, once the CPU has been allocated to a process, the
process keeps the CPU until it releases it either by terminating or by switching to the
waiting state.
 Otherwise, it is preemptive scheduling.

Define Dispatcher and list the his Function?


Dispatcher module gives control of the CPU to the process selected by the CPU scheduler
this function involves:
1. Context switch: Switching context from one process to another.
2. Switching to user mode.
3. Jumping to the proper location in the user program to restart (resume) that program.

State the difference between Preemptive and Non-preemptive SJF?


• A preemptive SJF algorithm will preempt the currently executing process, whereas
• A non-preemptive SJF algorithm will allow the currently running process to finish its CPU
burst.
 Preemptive SJF scheduling is sometimes called shortestremaining-time-first scheduling.

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 12


Define (FCFS) Scheduling and list it’s pros and cons?
FCFS algorithm: the process that requests the CPU first is allocated the CPU first.
Advantage: The simplest CPU-scheduling algorithm.
 Disadvantage:
• The average waiting time under the FCFS policy is often quite long.
• The FCFS algorithm is particularly troublesome for interactive systems, where it is
important that each process get a share of the CPU at regular intervals.
• It would be disastrous to allow one process to keep the CPU for an extended period. Short
jobs get stuck behind long jobs
 There is a convoy effect as all the other processes wait for the one big process to get off
the CPU.

Define Shortest-Job-First (SJF)Scheduling and list it’s pros and cons?


When the CPU is available, it is assigned to the process that has the smallest next CPU
burst.
 Advantage:
• SJF is optimal – it gives the minimum average waiting time for a given set of processes.
 Disadvantage:
 Starvation: Long-running jobs may starve if too many short jobs.
 The difficulty is knowing the length of the next CPU request.

Define Round Robin (RR) Scheduling and list it’s pros and cons?
 The round-robin (RR) scheduling algorithm is similar to FCFS scheduling, but preemption
is added to enable the system to switch between processes. The RR scheduling algorithm is
thus preemptive.
 Advantages:
• better response. Fair allocation of CPU across processes.
• No starvation.
• The RR is designed especially for timesharing systems.
 Disadvantages:
• The average waiting time under the RR policy is often long.
• Typically, higher average turnaround than SJF.

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 13


First- Come, First-Served (FCFS) Scheduling

Shortest-Job-First (SJF) Scheduling

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 14


Example of Preemptive SJF

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 15


Example of Non-Preemptive SJF

The round-robin (RR)

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 16


Part 2 MCQ Question
……………..is software that manages a computer’s hardware
Operating System
System software
kernel
All of the above

…………………acts as an intermediary between a user of a computer and the computer


hardware.
Operating System
System software
kernel
All of the above

………………provides an environment within which other programs can do useful work.


Operating System
System software
kernel
All of the above

……………….– provides the basic computing resources for the System


Hardware
Operating system
Application programs
Users

……………………..Central Processing Unit (CPU), memory, Input/Output (I/O) devices.


Hardware
Operating system
Application programs
Users

………………………………..Controls the hardware and coordinates its use among the various
application programs for the various users.
Hardware
Operating system
Application programs
Users

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 17


……………………– define the ways in which the system resources are used to solve the
computing problems of the users
Hardware
Operating system
Application programs
Users

…………………: Word processors, compilers, web browsers, database systems, video games,
Hardware
Operating system
Application programs
Users

…………………….People, machines, other computers.


Hardware
Operating system
Application programs
Users

Operating System Top Down View ………………..


User view
System view

………………………….the computer varies according to the interface being used.


User view
System view

………………………Users want convenience, ease of use and good performance.


User view
System view

Operating System Bottom Up View …………………………...


User view
System view

………………………………..the operating system is the program most intimately involved with


the hardware.
User view
System view

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 18


………………………It must decide how to allocate resources to specific programs and users so
that it can operate the computer system efficiently and fairly.
User view
System view

OS is a ……………….making efficient use of hardware (HW)


resource allocator
manager
control program

The operating system acts as ………………………….of the computer resources.


resource allocator
manager
control program

OS is a …………………….for managing execution of user programs and controlling the various


I/O devices to prevent errors and improper use of the computer.
resource allocator
manager
control program

The one program running at all times on the computer” called the…………………, part of the
operating system.
Kernel
Operating system
System program
Application program

…………………..ships with the operating system, but not part of the kernel
Kernel
Operating system
System program
Application program

…………………..all programs not associated with the operating system.


Kernel
Operating system
System program
Application program

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 19


Each ……………………….is in charge of a particular device type
device controller
device driver

Each ……………………. has a local buffer and a set of special-purpose registers.


device controller
device driver

The …………………… moves the data between its controlled device(s) and its buffer.
device controller
device driver

……………………informs CPU that it has finished its operation by causing an interrupt


device controller
device driver

…………………..transfers blocks of data from buffer storage directly to main memory without
CPU intervention.
device controller
device driver

Each device controller type has an operating system ………………..to manage it.
device controller
device driver

……………………. are part of the operating system, but not necessarily part of the OS kernel.
device controller
device driver

The ……………………………… manages I/O and provides uniform interface between the device
controller and kernel.
device controller
device driver

…………………..are used by devices for asynchronous event notification


Interrupts
interrupt handler
Interrupt Vector Table

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 20


Device controller informs CPU that it has finished its operation by causing an ……………………
Interrupts
interrupt handler
Interrupt Vector Table

Transfer to the…………………………., also known as the interrupt service routine (ISR).


Interrupts
interrupt handler
Interrupt Vector Table
When an interrupt is fired, the CPU jumps to a predefined position in the kernel's address space and executes an
……………..
Interrupts
interrupt handler
Interrupt Vector Table

A table of pointers to interrupt routines can be used instead to provide the necessary
speed.
Interrupts
interrupt handler
Interrupt Vector Table

………………..hold the addresses of the interrupt service routines for the various devices.
Interrupts
interrupt handler
Interrupt Vector Table

……………. registers, cache memory, and main memory.


Primary storage
Secondary storage
Tertiary storage

………………………..extension of main memory that provides large nonvolatile storage


capacity.
Primary storage
Secondary storage
Tertiary storage

…………………….is also much slower than main memory.


Primary storage
Secondary storage
Tertiary storage

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 21


………………. Include Hard disk , non volatile Memory
Primary storage
Secondary storage
Tertiary storage

………………….Include magnetic tapes, CD-ROM


Primary storage
Secondary storage
Tertiary storage

…………………… They are slow enough and large enough that they are used only for special
purposes.
Primary storage
Secondary storage
Tertiary storage

……………………. Store backup copies of material stored on other devices.


Primary storage
Secondary storage
Tertiary storage

The …………….is the component that executes instructions and registers for storing data
locally.
Core
arithmetic-logic unit (ALU)
cluster

An ……………………..is the part of a computer processor (CPU) that carries out arithmetic and
logic operations.
Core
arithmetic-logic unit (ALU)
cluster

A ………………………consists of several computer systems (nodes) connected via a network;


each node is typically a multicore system.
Core
arithmetic-logic unit (ALU)
cluster

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 22


……………… is capable of executing a general-purpose instruction set, including instructions
from processes.
Single-Processor Systems.
Multiprocessor Systems.
Clustered Systems.

……………………..Have two (or more) processors, each with a single-core CPU.


Single-Processor Systems.
Multiprocessor Systems.
Clustered Systems.

…………………….Also known as parallel systems, tightly-coupled systems.


Single-Processor Systems.
Multiprocessor Systems.
Clustered Systems.

Two Types of …………………..:Asymmetric Multiprocessing. • Symmetric Multiprocessing


(SMP).
Single-Processor Systems.
Multiprocessor Systems.
Clustered Systems.

……………………….Like multiprocessor systems, but multiple systems working together


Single-Processor Systems.
Multiprocessor Systems.
Clustered Systems.

……………………These systems are considered loosely coupled.


Single-Processor Systems.
Multiprocessor Systems.
Clustered Systems.

……………………. Some clusters are for high-performance computing (HPC).


Single-Processor Systems.
Multiprocessor Systems.
Clustered Systems.

…………………each processor is assigned a specific task.


Asymmetric Multiprocessing
Symmetric Multiprocessing (SMP)
Asymmetric Clustering
Symmetric Clustering

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 23


…………………………………..A master–slave relationship.
Asymmetric Multiprocessing
Symmetric Multiprocessing (SMP)
Asymmetric Clustering
Symmetric Clustering

………………each processor performs all tasks (including OS functions and user processes).
Asymmetric Multiprocessing
Symmetric Multiprocessing (SMP)
Asymmetric Clustering
Symmetric Clustering

………………………….The most common Multiprocessor systems.


Asymmetric Multiprocessing
Symmetric Multiprocessing (SMP)
Asymmetric Clustering
Symmetric Clustering

………………………..All processors are peers; no master–slave relationship exists between


processors.
Asymmetric Multiprocessing
Symmetric Multiprocessing (SMP)
Asymmetric Clustering
Symmetric Clustering

……………………….One machine is in hot-standby mode while the other is running the


applications.
Asymmetric Multiprocessing
Symmetric Multiprocessing (SMP)
Asymmetric Clustering
Symmetric Clustering

………………….Two or more hosts (nodes) are running applications and are monitoring each
other.
Asymmetric Multiprocessing
Symmetric Multiprocessing (SMP)
Asymmetric Clustering
Symmetric Clustering

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 24


For a computer to start running, when it is powered up or rebooted—it needs to have an
initial program to run…………..
Bootstrap program
Kernel
Interrupt

…………………Typically stored in read-only memory (ROM) or Electrically erasable


programmable read-only memory (EPROM)
Bootstrap program
Kernel
Interrupt

…………………………Loads operating system kernel and starts execution.


Bootstrap program
Kernel
Interrupt

………………………….Starts system daemons which run the entire time the kernel is running
Bootstrap program
Kernel
Interrupt

Once the ………………………is loaded and executing, it can start providing services to the
system and its users.
Bootstrap program
Kernel
Interrupt

Events are almost always signaled by the occurrence of an…………………...


Bootstrap program
Kernel
Interrupt

…………………….is interrupt driven (i.e. hardware and software interrupts


Bootstrap program
Kernel
Interrupt

In a ……………………system, a program in execution is termed a process.


Multiprogramming
job scheduling
Multitasking (Timesharing)

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 25


……………………… organizes jobs (code and data) so CPU always has one to execute.
Multiprogramming
job scheduling
Multitasking (Timesharing)

One job selected and run via……………………..


Multiprogramming
job scheduling
Multitasking (Timesharing)

…………………..A logical extension of Batch systems – the CPU switches jobs so frequently that
users can interact with each job while it is running, creating interactive computing.
Multiprogramming
job scheduling
Multitasking (Timesharing)

……………………Having several processes in memory at the same time requires some form of
memory management.
Multiprogramming
job scheduling
Multitasking (Timesharing)

…………………operation allows OS to protect itself and other system components


Dual-mode
kernel mode
mode bit
user mode

……………………………(also called supervisor mode, system mode, or privileged mode


Dual-mode
kernel mode
mode bit
user mode

Some instructions designated as privileged, only executable in …………………...


Dual-mode
kernel mode
mode bit
user mode

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 26


When the OS gains control of the computer, it is in ………………………
Dual-mode
kernel mode
mode bit
user mode

At system boot time, the hardware starts in …………………………..


Dual-mode
kernel mode
mode bit
user mode

instructions that modify the content of the timer are privileged.


Dual-mode
kernel mode
mode bit
user mode

The OS is then loaded and starts user applications in………………………..


Dual-mode
kernel mode
mode bit
user mode

…………………………Provides ability to distinguish when system is running user code or kernel


code.
Dual-mode
kernel mode
mode bit
user mode

……………………: Multiple I/O requests may arrive by different processes and only one I/O
request can be served at a time by the disk controller.
Disk scheduling
Mounting
Caching

…………………a file system (e.g. NTFS or FAT) is making the file system available for use by the
system and its users.
Disk scheduling
Mounting
Caching
With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 27
………………… is an important principle, performed at many levels in a computer (in
hardware, operating system, software).
Disk scheduling
Mounting
Caching

………………….Information in use copied from slower to faster storage temporarily.


Disk scheduling
Mounting
Caching

……………….. (storing data temporarily while it is being transferred)


buffering
caching
spooling

………………(storing parts of data in faster storage for performance)


buffering
caching
spooling

………………… (a buffer that holds output for a device, such as a printer, that cannot accept
interleaved data streams)
buffering
caching
spooling

……………………If a computer system has multiple users and allows the concurrent execution
of multiple processes, then access to data must be regulated.
Protection
Security

………………..– any mechanism for controlling access of processes or users to resources


defined by the OS.
Protection
Security

………………………..A system can have adequate protection but still be prone to failure and
allow inappropriate access.
Protection
Security

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 28


………………………………..defense of the system against internal and external attacks.
Protection
Security

…………………include name and associated number (unique), one per user.


User ID
Group identifier (group ID)
Privilege escalation

………………………………then associated with all files, processes, and threads of that user to
determine access control.
User ID
Group identifier (group ID)
Privilege escalation

…………………..allows set of users to be defined and controls managed, then also associated
with each file, process, and thread.
User ID
Group identifier (group ID)
Privilege escalation

………………………..allows user to change to effective ID with more rights.


User ID
Group identifier (group ID)
Privilege escalation

…………………allows operating systems to run as applications within other operating systems.


Virtualization
VMware
virtual machine manager (VMM).

……………….. created a new virtualization technology in the form of an application that ran
on Windows.
Virtualization
VMware
virtual machine manager (VMM).

Windows was the host operating system, and the VMware application was the………………….
Virtualization
VMware
virtual machine manager (VMM).

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 29


…………………. provides virtualization services.
Virtualization
VMware
virtual machine manager (VMM).

The ……………………………… runs the guest operating systems, manages their resource use,
and protects each guest from the others.
Virtualization
VMware
virtual machine manager (VMM).

………………..connects computers within a room, a building, or a campus.


Local Area Network (LAN)
Wide Area Network (WAN)
Metropolitan Area Network (MAN)
Personal Area Network (PAN)

………………………. usually links buildings, cities, or countries.


Local Area Network (LAN)
Wide Area Network (WAN)
Metropolitan Area Network (MAN)
Personal Area Network (PAN)

…………………….could link buildings within a city.


Local Area Network (LAN)
Wide Area Network (WAN)
Metropolitan Area Network (MAN)
Personal Area Network (PAN)

………………………between a smartphone and a desktop computer (i.e. using BlueTooth).


Local Area Network (LAN)
Wide Area Network (WAN)
Metropolitan Area Network (MAN)
Personal Area Network (PAN)

A …………………is an operating system that provides features (such as file sharing) across the
network, along with a communication scheme that allows different processes on different
computers to exchange messages.
network operating system
distributed operating system

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 30


A computer running a ………………………… acts autonomously from all other computers on the
network, although it is aware of the network and is able to communicate with other
networked computers.
network operating system
distributed operating system

A ………………………provides a less autonomous environment. The different computers


communicate closely enough to provide the illusion that only a single operating system
controls the network.
network operating system
distributed operating system

work on Stand-alone general-purpose machines…………….


Traditional
Mobile
Client Server
Peer-to-Peer

Most users once had a single computer with a slow modem connection to the office, the
Internet, or both…………………
Traditional
Mobile
Client Server
Peer-to-Peer

With …………………….Remote access was difficult, and portability was achieved by use of
laptop computers.
Traditional
Mobile
Client Server
Peer-to-Peer

…………………….refers to computing on smartphones, tablets


Traditional
Mobile
Client Server
Peer-to-Peer

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 31


…………………….Two operating systems currently dominate mobile computing: Apple iOS and
Google Android.
Traditional
Mobile
Client Server
Peer-to-Peer

………………….Contemporary network architecture features arrangements in which systems


satisfy requests generated by another systems
Traditional
Mobile
Client Server
Peer-to-Peer

………………………..does not distinguish clients and servers: Instead all nodes are considered
the same.
Traditional
Mobile
Client Server
Peer-to-Peer

Examples of peer-to-peer computing include Napster and Gnutella, Voice over IP (VoIP)
such as Skype…………………
Traditional
Mobile
Client Server
Peer-to-Peer

…………………is a type of computing that delivers computing, storage, and even applications
as a service across a network.
Cloud Computing
Real-Time Embedded Systems
Mobile
Client Server

…………………….It is a logical extension of virtualization because it uses virtualization as the


base for its functionality.
Cloud Computing
Real-Time Embedded Systems
Mobile
Client Server

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 32


………………..environments composed of traditional operating systems, plus VMMs, plus
cloud management tools
Cloud Computing
Real-Time Embedded Systems
Mobile
Client Server

……………………..These devices are found everywhere, from car engines and manufacturing
robots to optical drives and microwave ovens.
Cloud Computing
Real-Time Embedded Systems
Mobile
Client Server

………………… has well-defined, fixed time constraints.


Cloud Computing
Real-Time Embedded Systems
Mobile
Client Server

……………………….. Processing must be done within the defined constraints, or the system will
fail.
Cloud Computing
Real-Time Embedded Systems
Mobile
Client Server

………………………. functions correctly only if it returns the correct result within its time
constraints.
Cloud Computing
Real-Time Embedded Systems
Mobile
Client Server

Systems that control scientific experiments, medical imaging systems, industrial control
systems, and certain display systems………………….
Cloud Computing
Real-Time Embedded Systems
Mobile
Client Server

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 33


……………………: the user uses a keyboard for typing in text commands in a specific format
with specific options
Command-Line Interpreter (CLI)
Graphics User Interface (GUI)
Touch-screen interface

……………………..allows direct command entry.


Command-Line Interpreter (CLI)
Graphics User Interface (GUI)
Touch-screen interface

………………………. Primarily fetches a command from user and executes it.


Command-Line Interpreter (CLI)
Graphics User Interface (GUI)
Touch-screen interface

………………………… (multiple command interpreters to choose from) implemented – shells.


Command-Line Interpreter (CLI)
Graphics User Interface (GUI)
Touch-screen interface

………………….: the most commonly used.


Command-Line Interpreter (CLI)
Graphics User Interface (GUI)
Touch-screen interface

………………………Users employ a mouse-based window-and-menu system characterized by a


user-friendly desktop metaphor interface
Command-Line Interpreter (CLI)
Graphics User Interface (GUI)
Touch-screen interface

………………… Icons represent programs, files, directories, system functions,


Command-Line Interpreter (CLI)
Graphics User Interface (GUI)
Touch-screen interface

………………………: provided by mobile systems such as phones and tablets.


Command-Line Interpreter (CLI)
Graphics User Interface (GUI)
Touch-screen interface

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 34


………………… Mouse not possible or not desired.
Command-Line Interpreter (CLI)
Graphics User Interface (GUI)
Touch-screen interface

…………………………. Actions and selection based on gestures.


Command-Line Interpreter (CLI)
Graphics User Interface (GUI)
Touch-screen interface

…………………….. allows Voice commands


Command-Line Interpreter (CLI)
Graphics User Interface (GUI)
Touch-screen interface

Application developers design programs according to an ………………………..


application programming interface (API).
System Call

……………………… specifies a set of functions that are available to an application programmer,


including the parameters that are passed to each function and the return values the
programmer can expect.
application programming interface (API).
System Call

Three most common APIs are ………………for Windows systems, …………………for systems
(including virtually all versions of UNIX, Linux, and Mac OS X
Windows API, POSIX API
POSIX API ,Windows API
Windows API, Windows API
POSIX API, POSIX API

Source code compiled into object files designed to be loaded into any physical memory
location – a format known as……………………..
relocatable object file
Linker
Loader
dynamically linked libraries

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 35


………………..combines these relocatable object files into single binary executable file.
relocatable object file
Linker
Loader
dynamically linked libraries

Program resides on secondary storage as binary executable, it must be brought into


memory by ………………….to be executed
relocatable object file
Linker
Loader
dynamically linked libraries

The …………………. then loads the specified program into memory using the address space of
the newly created process.
relocatable object file
Linker
Loader
dynamically linked libraries

…………………. are loaded as needed, shared by all that use the same version of that same
library
relocatable object file
Linker
Loader
dynamically linked libraries

………….Get time or date, set time or date


File management:
Device management:
Information maintenance:
Communications:

………………. Get device attributes, set device attributes


File management:
Device management:
Information maintenance:
Communications:

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 36


………………. Get and set permissions, Allow and deny user access
File management:
Device management:
Information maintenance:
Protection

…………………….The simplest structure for organizing an OS is no structure at all.


Monolithic Structure
Layered Approach
Microkernels
Modules

………………….Place all of the functionality of the kernel into a single, static binary file that
runs in a single address space.
Monolithic Structure
Layered Approach
Microkernels
Modules

An example of such …………………………. is the original UNIX OS


Monolithic Structure
Layered Approach
Microkernels
Modules

The Linux kernel is ………………….. in that it runs entirely in kernel mode in a single address
space
Monolithic Structure
Layered Approach
Microkernels
Modules

……………….. is often known as a tightly coupled system because changes to one part of the
system can have wide-ranging effects on other parts.
Monolithic Structure
Layered Approach
Microkernels
Modules

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 37


This system is divided into separate, smaller components that have specific and limited
functionality.
Monolithic Structure
Layered Approach
Microkernels
Modules

It’s known as a loosely coupled system


Monolithic Structure
Layered Approach
Microkernels
Modules

……………………..The OS is divided into a number of layers (levels) each built on top of lower
layers. The bottom layer (layer 0), is the hardware; the highest (layer N) is the user
interface.
Monolithic Structure
Layered Approach
Microkernels
Modules

This method structures the OS by removing all nonessential components from the kernel
and implementing them as user-level programs that reside in separate address spaces.
Monolithic Structure
Layered Approach
Microkernels
Modules

…………………… provide minimal process and memory management, in addition to a


communication facility.
Monolithic Structure
Layered Approach
Microkernels
Modules

Mach OS is an example of…………………………….


Monolithic Structure
Layered Approach
Microkernels
Modules

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 38


The main function of the …………………… is to provide communication between the client
program and the various services that are also running in user space
Monolithic Structure
Layered Approach
Microkernels
Modules

………………….Perhaps the best current methodology for operating-system design involves


using loadable kernel modules (LKMs).
Monolithic Structure
Layered Approach
Microkernels
Modules

……………………….The approach is also similar to the microkernel approach in that the primary
module has only core functions and knowledge of how to load and communicate with other
modules
Monolithic Structure
Layered Approach
Microkernels
Modules

Linux uses loadable kernel modules, primarily for supporting device drivers and file
systems………………………
Monolithic Structure
Layered Approach
Microkernels
Modules

……………….it is more efficient, because modules do not need to invoke message passing in
order to communicate.
Monolithic Structure
Layered Approach
Microkernels
Modules

………………is finding and fixing errors, or bugs in a system.


Debugging
performance tuning
log files

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 39


Performance problems are considered bugs, so debugging can also include …………………..
Debugging
performance tuning
log files

OS generate ………………….containing error information.


Debugging
performance tuning
log files

………….section: The program code (the executable code).


Text
Data
Heap
Stack

………………… section containing global variables.


Text
Data
Heap
Stack

…………… section containing memory dynamically allocated during program run time.
Text
Data
Heap
Stack

…………..section containing temporary data when invoking functions.


Text
Data
Heap
Stack

……………: The process is being created.


New
Running
Waiting:
Ready
Terminated

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 40


…………………….: Instructions are being executed.
New
Running
Waiting:
Ready
Terminated

…………….The process is waiting for some event to occur (such as an I/O completion or
reception of a signal).
New
Running
Waiting:
Ready
Terminated

…………………: The process is waiting to be assigned to a processor.


New
Running
Waiting:
Ready
Terminated

………………………: The process has finished execution.


New
Running
Waiting:
Ready
Terminated

An …………….is one that spends more of its time doing I/O than it spends doing
computations.
I/O-bound process
A CPU-bound process
All of the above
Non of the above

…………………, in contrast, generates I/O requests infrequently, using more of its time doing
computations.
I/O-bound process
A CPU-bound process
All of the above
Non of the above
With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 41
…………may execute for only a few milliseconds before waiting for an I/O request.
I/O-bound process
A CPU-bound process
All of the above
Non of the above

………………………will require a CPU core for longer durations.


I/O-bound process
A CPU-bound process
All of the above
Non of the above

……………..– set of all processes residing in main memory, ready and waiting to execute. This
queue is generally stored as a linked list.
Ready queue
Wait queues
All of the above
Non of the above

A new process is initially put in the…………………………..


Ready queue
Wait queues
All of the above
Non of the above

The process could be removed forcibly from the core, as a result of an interrupt or having
its time slice expire, and be put back in the …………………….
Ready queue
Wait queues
All of the above
Non of the above

…………………….. – set of processes waiting for a certain event to occur


Ready queue
Wait queues
All of the above
Non of the above

The process could issue an I/O request and then be placed in an I/O ……………………………
Ready queue
Wait queues
All of the above
Non of the above
With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 42
The process could create a new child process and then be placed in a …………………… while it
awaits the child’s termination.
Ready queue
Wait queues
All of the above
Non of the above

………………….– new, running, waiting.


Process state
Program counter
CPU registers
CPU-scheduling information

……………….address (location) of the next instruction to be executed for this process.


Process state
Program counter
CPU registers
CPU-scheduling information

…………………..contents of all process-centric registers.


Process state
Program counter
CPU registers
CPU-scheduling information

……………………….a process priority, pointers to scheduling queues.


Process state
Program counter
CPU registers
CPU-scheduling information

……………………..memory allocated to the process.


Memory-management information
Accounting information
I/O status information

…………………….amount of CPU used, clock time elapsed since start, time limits, account
numbers, job or process numbers.
Memory-management information
Accounting information
I/O status information

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 43


………………….list of I/O devices allocated to the process, list of open files.
Memory-management information
Accounting information
I/O status information

…………………..of control allows the process to perform only one task at a time.
single thread
multiple threads

when a process is running a word-processor program, a ………………. of instructions is being


executed.
single thread
multiple threads

A traditional process has a ……………………. of control.


single thread
multiple threads

Most modern operating systems have extended the process concept to allow a process to
have …………………of execution and thus to perform more than one task at a time.
single thread
multiple threads

…………………….is especially beneficial on multicore systems, where multiple threads can run
in parallel.
single thread
multiple threads

If a process has ……………………… of control, it can perform more than one task at a time.
single thread
multiple threads

……………………..It shares with other threads belonging to the same process its code section,
data section
single thread
multiple threads

When CPU switches to another process, the system must do the following via a …………………
context switch
Context
Dispatch latency

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 44


……………………………..of a process is represented in the PCB of the process.
context switch
Context
Dispatch latency

……………………..time it takes for the dispatcher to stop one process and start another
running.
context switch
Context
Dispatch latency

………………..system call creates a new process.


fork()
exec()
wait()
exit()

……………………system call used after a fork() to replace the process ’ memory space with a
new program.
fork()
exec()
wait()
exit()

Parent process calls ………………….waiting for the child to terminate.


fork()
exec()
wait()
exit()

Process executes last statement and then asks the operating system to delete it using the
…………….system call.
fork()
exec()
wait()
exit()

Parent may terminate the execution of children processes using the ……………..system call.
abort()
fork()
exec()
wait()

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 45


…………………manages user interface, disk and network I/O.
Browser process
Renderer process
Plug-in process

A new process is created when Chrome is started. Only one …………………. is created.
Browser process
Renderer process
Plug-in process

………………….renders web pages, deals with HTML, Javascript, images


Browser process
Renderer process
Plug-in process

A ……………………. created for each website opened in a new tab.


Browser process
Renderer process
Plug-in process

…………………….is created for each type of plug-in (e.g. QuickTime) in use.


Browser process
Renderer process
Plug-in process

Under…………….., each process that wants to communicate must explicitly name the
recipient or sender of the communication.
direct communication
indirect communication
Blocking communication
Non-blocking communication

…………………A Link is established automatically between every pair of processes that want
to communicate. The processes need to know only each other’s identity to communicate.
direct communication
indirect communication
Blocking communication
Non-blocking communication

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 46


With……………………., the messages are sent to and received from mailboxes, or ports.
direct communication
indirect communication
Blocking communication
Non-blocking communication

With…………… is considered synchronous


direct communication
indirect communication
Blocking communication
Non-blocking communication

With …………… is considered asynchronous


direct communication
indirect communication
Blocking communication
Non-blocking communication

………………-- the sender process is blocked until the message is received by the receiving
process or by the mailbox.
Blocking send
Blocking receive
non-blocking send
Non-blocking receive

…………………… -- the receiver is blocked until a message is available.


Blocking send
Blocking receive
non-blocking send
Non-blocking receive

……………..-- the sender process sends the message and continue (i.e. resumes operation).
Blocking send
Blocking receive
non-blocking send
Non-blocking receive

……………….-- the receiver receives a valid message, or a Null.


Blocking send
Blocking receive
non-blocking send
Non-blocking receive
With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 47
The ……………….merely invokes the blocking send() call and waits until the message is
delivered to either the receiver or the mailbox.
Producer
Consumer
All of the above
Non of the above

when the ……………….invokes the blocking receive() call, it blocks until a message is available.
Producer
Consumer
All of the above
Non of the above

……………..: no messages are queued on a link. Sender must wait for receiver
Zero capacity
Bounded capacity
Unbounded capacity
All of the above

…………………: The queue has finite length of n messages, at most n messages can reside in it.
Sender must wait if link is full.
Zero capacity
Bounded capacity
Unbounded capacity
All of the above

……………..: infinite length, sender never waits.


Zero capacity
Bounded capacity
Unbounded capacity
All of the above

It can be faster than message passing, since message-passing systems are typically
implemented using system calls and thus require the more time-consuming task of kernel
intervention.
Shared memory
Message passing
All of the above
Non of the above

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 48


……………….is useful for exchanging smaller amounts of data, because no conflicts need be
avoided.
Shared memory
Message passing
All of the above
Non of the above

item next_produced;
while (true) {
/* produce an item in next produced */
while (((in + 1) % BUFFER_SIZE) == out)
; /* do nothing */
buffer[in] = next_produced;
in = (in + 1) % BUFFER_SIZE;
}
Producer process in shared Memory
Consumer process in shared Memory
Producer process in Message Passing
Consumer process in Message Passing

item next_consumed;
while (true) {
while (in == out)
; /* do nothing */
next_consumed = buffer[out];
out = (out + 1) % BUFFER_SIZE;
/* consume the item in next consumed */
}
Producer process in shared Memory
Consumer process in shared Memory
Producer process in Message Passing
Consumer process in Message Passing

message next_produced;
while (true) {
/* produce an item in next_produced */
send(next_produced);
}
Producer process in shared Memory
Consumer process in shared Memory
Producer process in Message Passing
Consumer process in Message Passing

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 49


message next_consumed;
while (true) {
receive(next_consumed)
/* consume the item in next_consumed */
}
Producer process in shared Memory
Consumer process in shared Memory
Producer process in Message Passing
Consumer process in Message Passing

…………..allow communication in standard producer-consumer style.


Ordinary pipes
Named pipes

………………..are therefore unidirectional, allowing only one-way communication.


Ordinary pipes
Named pipes

…………………..Require parent-child relationship between communicating processes.


Ordinary pipes
Named pipes

……………………….on Windows are termed anonymous pipes


Ordinary pipes
Named pipes

…………………….is bidirectional.
Ordinary pipes
Named pipes

………………… No parent-child relationship is necessary between the communicating


processes.
Ordinary pipes
Named pipes

Both UNIX and Windows systems support …………………….., although the details of
implementation differ greatly.
Ordinary pipes
Named pipes

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 50


Consider the following set of processes, the length of the CPU
burst time given in milliseconds.
Process Burst time
P1 6
P2 8
P3 7
P4 3

Assuming the above process being scheduled with the SJF scheduling algorithm.
a) The waiting time for process P1 is 3ms
b) The waiting time for process P1 is 0ms
c) The waiting time for process P1 is 16ms
d) The waiting time for process P1 is 9ms

Assuming the above process being scheduled with the SJF scheduling algorithm. The
average waiting time is
a) 6ms
b) 6.5ms
c) 7ms
d) 7.5ms

Assuming the above process being scheduled with the SJF scheduling algorithm. The
average turnaround time is
a) 13 ms
b) 13.5ms
c) 14 ms
d) 14.5ms

Process Burst Time


P1 7
P2 4
P3 7

Suppose that the processes arrive at time 0 in the order: P1 , P2 , P3


Answer the following questions using this data and using the First- Come, First-Served
(FCFS) scheduling algorithm.
What is the waiting time for P1?
0
7
11
15
With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 51
What is the waiting time for P2?
12
7
11
13

What is the average waiting time?


6
7
8
9

What is the turnaround time for P2?


10
7
11
9

What is the average turnaround time?


11
15
12
10

Regarding the scheduling algorithm optimization criteria, It is desirable to:


a. Minimize CPU utilization
b. Maximize throughput
c. Maximize turnaround time
d. Maximize waiting time

A process is in the “running” state, then an interrupt occurs then the process moves to the
following state:
New
Waiting
Ready
Terminated

The processor execution mode that user programs typically execute in is referred to as:
a. System mode.
b. None of the above.
c. Kernel mode.
d. User mode.
With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 52
In a system employing message passing, when a message is sent to a shared temporary
data structure, this general approach is known as:
a. Indirect communication.
b. Direct communication.
c. Blocking.
d. None of the above.

………………….– the amount of time to execute a particular process.


Turnaround time
Waiting time
Response time

The interval from the time of submission of a process to the time of completion is
the…………………..
Turnaround time
Waiting time
Response time

……………..is the sum of the periods spent waiting in the ready queue, executing on the CPU,
and doing I/O.
Turnaround time
Waiting time
Response time

………………….– the amount of time a process has been waiting in the ready queue.
Turnaround time
Waiting time
Response time

…………………..– the amount of time it takes from when a request was submitted until the
first response is produced.
Turnaround time
Waiting time
Response time

………………….. It is the time it takes to start execute


Turnaround time
Waiting time
Response time

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 53


………………..When the CPU is available, it is assigned to the process that has the smallest
next CPU burst.
First come first service
Shortest job first
Round Robin
Priority scheduling

……………….it gives the minimum average waiting time for a given set of processes.
First come first service
Shortest job first
Round Robin
Priority scheduling

scheduling algorithm is similar to FCFS scheduling, but preemption is added to enable the
system to switch between processes.
First come first service
Shortest job first
Round Robin
Priority scheduling

………………… A small unit of time, called a time quantum or time slice, is defined.
First come first service
Shortest job first
Round Robin
Priority scheduling

………………………… A priority number (integer) is associated with each process.


First come first service
Shortest job first
Round Robin
Priority scheduling

……………….– low priority processes may never execute.


Starvation
Aging
All of the above
Non of the above

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 54


……………………– as time progresses increase the priority of the process.
Starvation
Aging
All of the above
Non of the above

……………….algorithm will preempt the currently executing process


A preemptive SJF
A non-preemptive SJF
All of the above
Non of the above

……………………algorithm will allow the currently running process to finish its CPU burst.
A preemptive SJF
A non-preemptive SJF
All of the above
Non of the above

……………………….: One approach to CPU scheduling in a multiprocessor system has all


scheduling decisions, I/O processing, and other system activities handled by a single
processor
Asymmetric multiprocessing
symmetric multiprocessing (SMP)
All of the above
Non of the above

…………………………….., where each processor is self-scheduling. The scheduler for each


processor examine the ready queue and select a thread to run.
Asymmetric multiprocessing
symmetric multiprocessing (SMP)
All of the above
Non of the above

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 55


Part 3 True and False
Question T/F
An operating system simply provides an environment within which other programs
can do useful work.
Computer system can be divided into three components
Depends on the point of view: Top Down View (System view).
Depends on the point of view: Bottom Up View (User view).
Users want convenience, ease of use and good performance.
Many computer users sit with a laptop or in front of a PC
Users want care about resource utilization
Mobile devices like smartphones and tablets are full of resource
Mobile user interfaces such as touch screens, and voice recognition.
Shared computer such as mainframe must keep his only user happy.
No universally accepted definition of what is part of the operating system.
One or more CPUs, device controllers connect through common bus providing
access to shared memory.
Sequential execution of CPUs and devices competing for memory cycles.
I/O devices and the CPU can execute concurrently.
CPU moves data from/to main memory to/from local buffers.
Device drivers are part of the operating system, but also necessarily part of the OS kernel.
Device-driver layer hides differences among I/O controllers from kernel.
Interrupts are used by devices for asynchronous event notification (these are
software interrupts).
Interrupts are used by devices for synchronous event notification (these are
hardware interrupts).
interrupt vector, of addresses is then indexed by a may be repeated number, given
with the interrupt request,
The operating system preserves the state of the CPU by storing the registers and
the program counter after execute interrupt.
The CPU initiates the data transfer, but can do other things while the transfer is
taking place. CPU utilization is decreased.
With Direct Memory Access interrupt is generated per byte, rather than the one
interrupt per block.
Dynamic random-access memory (DRAM) in the form of Random-access Memory (RAM).
smaller and faster memory far away to the CPU.
Because of resource sharing, multiprocessor systems are cheaper than multiple
single processor systems.
With multiprocessor the failure of one processor will not halt the whole system
A slave processor controls the system: schedules and allocates work to the master
processors.

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 56


A multicore processor with N cores appears to the operating system as N standard CPUs.
all modern operating systems—including Windows, mac OS, and Linux, as well as
Android and iOS mobile systems—support multicore SMP systems.
Software interrupt by one of the devices.
Hardware interrupt (exception or trap)
Multiprogramming organizes jobs (code and data) so CPU always has one to execute.
In a multiprogrammed system, the CPU would sit idle.
In a non-multiprogrammed system, the operating system simply switches to, and
executes, another process.
When a process executes, it typically executes for only a short time before it either
finishes or needs to perform I/O.
In Timesharing Response time should be> 1 second.
In Timesharing I/O may be interactive; that is, output goes to a display for the user,
and input
Virtual memory allows execution of processes not completely in memory.
When a user code is running mode bit = 0 is “user”.
When a kernel code is executing mode bit = 1 is “kernel”.
If an attempt is made to execute a privileged instruction in user mode, the
hardware execute the instruction
The instruction to switch to kernel mode is an example of a privileged instruction.
The OS is then loaded and starts user applications in kernel mode.
A process is a program in execution. It is a unit of work within the system.
Process is a passive entity while Program is an active entity.
Process termination requires reclaim of any reusable resources.
Multi -threaded process has one program counter specifying location of next
instruction to execute.
Single -threaded process has one program counter per thread.
To execute program all data and instruction must be in memory
Abstracts physical properties to logical storage unit - folder.
Files usually organized into directories.
Multitasking environments must be careful to use most recent value, no matter
where it is stored in the storage hierarchy.
Asynchronous I/O: After I/O starts, control returns to user program only upon I/O
completion.
Synchronous I/O: After I/O starts, control returns to user program without waiting
for I/O completion.
A network is a communication path between two or more systems.
With traditional OS Remote access was essay, and portability was achieved by use
of laptop computers.
web technologies and increasing WAN bandwidth allow companies to establish
portals, which provide web accessibility to their internal servers.
With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 57
Mobile devices share the distinguishing physical features of being portable and
lightweight.
clients responding to requests generated by Servers.
File-server system provides an interface for clients to store and retrieve files
In Embedded computers have very specific tasks.
In Embedded computers have little or no user interface.
In General computers the operating systems provide limited features.
Communications may occur between processes that are executing on the same
computer only
Communications may be via message passing (two or more processes read and
write to a shared section of memory)
Communications may be through shared memory (packets of information in
predefined formats are moved between processes by the OS)
Debugging facilities can greatly enhance the user’s and programmer’s abilities to
efficiently use the system.
A command-line interface or a mouse-and-keyboard system is practical for most
mobile systems
smartphones and handheld tablet computers typically use a CLI interface.
With Touch-screen devices Mouse not possible or not desired.
With Touch-screen devices Voice commands.
Apple Mac OS X is GUI with CLI “command” shell.
Microsoft Windows is “Aqua” GUI interface with UNIX kernel underneath and shells
available.
Unix and Linux have CLI with optional GUI interfaces
System calls provide a programming interface to the services provided by the OS.
Arduino is A multi-tasking system.
Arduino has operating system.
In Arduino Programs (sketch) loaded via USB into flash memory.
The Arduino is a simple hardware platform consisting of a microcontroller along
with input sensors that respond to a variety of events
An Arduino is considered a single-tasking system, as only one sketch can be present
in memory at a time;
the Arduino provides no user interface beyond hardware input sensors.
To start a new process, the shell executes a exec() system call.
the selected program is loaded into memory via an fork()system call, and the
program is executed.
System goals – operating system should be convenient to use, easy to learn,
reliable, safe, and fast.
User goals – operating system should be easy to design, implement, and maintain,
as well as flexible, reliable, error-free, and efficient.
Mechanism: determines How to do something?

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 58


Policy: determines What needs to be done?
Early operating systems were written in C.
Main body in assembly language.
More high-level language easier to port to other hardware. But slower.
clustered systems Also known as parallel systems
Symmetric called master slave relationship
Asymmetric All processors are peers; no master–slave relationship exists between
processors.
Each CPU processor has its own set of registers and a private or local cache.
A multicore processor with N cores appears to the operating system as N standard CPUs.
In dual core Each core has its own register set, as well as its own local cache, often
known as a level 2, or L2, cache.
In dual core A level 1 (L1) cache is local to the chip but is shared by the two
processing cores.
the main advantage of Non-Uniform Memory Access (NUMA) System: Increased
latency when a CPU accesses remote memory across the system interconnect
the main disadvantage of Non-Uniform Memory Access (NUMA) System: Fast access of a
CPU to its local memory with no contention over the system interconnect.
Advantages of Clustered Systems: Provides a high-availability service which survives
failures.
The Linux kernel is monolithic in that it runs entirely in kernel mode in a single
address space
disadvantages of Monolithic are speed and efficiency kernels do have a distinct
advantages of Monolithic are They are difficult to implement and extend
The monolithic approach is often known as a tightly coupled system
Mach OS is an example of microkernel
Hybrid system combines multiple approaches (structures) to address performance,
security, usability needs.
Failure of an application can generate crash dump file capturing memory of the process.
OS failure can generate core dump file containing kernel memory.
Process execution must progress in sequential fashion. No parallel execution of
instructions of a single process.
No parallel execution of instructions of a single process.
The sizes of the text and data sections are not fixed,
The stack and heap sections can shrink and grow dynamically during program execution.
the heap will grow as memory is dynamically allocated, and will shrink when
memory is returned to the system.
the operating system can’t ensure they do not overlap one another.
A Program becomes a process when an executable file is loaded into memory.
The state of a process is defined in part by the current activity of that process.
Only one process can be running on any processor core at any instant.

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 59


one process may be ready and waiting.
process control block (PCB) (also called a task control block)
A traditional process has a single thread of control
The objective of time sharing is to have some process running at all times so as to
maximize CPU utilization.
The objective of multiprogramming is to switch a CPU core among processes so
frequently that users can interact with each program while it is running.
Process scheduler selects among available processes for next
execution on CPU core.
For a system with a single CPU core, only one process is running at a time, whereas
a multicore system can run multiple processes at one time.
The number of processes currently in memory is known as the degree of
multiprogramming.
Switching speed same as from machine to machine.
Context-switch time is pure overhead; the system does no useful work while switching.
The more complex the OS and the PCB the shorter the context switch.
children process create Parent processes, which, in turn create other processes,
forming a tree of processes.
process identified and managed via a unique process identifier (pid) (it is an double
number).
If no parent waiting (did not invoke wait()) process is a orphan process.
If parent terminated without invoking wait(), process is an zombie process.
A process is independent if it does not share data with any other processes
executing in the system.
A cooperating process can affect or be affected by other processes executing in the
system, including sharing data.
Process scheduler selects among available processes for next execution on CPU core.
Message passing provides a mechanism to allow processes to communicate and to
synchronize their actions without sharing the same address space.
Mailbox is owned by a process (that is, the mailbox is part of the address space of
the process)
socket is identified by a concatenation of IP address and port (i.e. a number to
differentiate network services on a host
In Named Pipes are more powerful than ordinary pipes. Communication is
bidirectional.
Context-switch time is pure overhead; the system does no useful work while
switching
A context switch occurs when the CPU switches from one process to another.
children process create Parent processes, which, in turn create other processes,
forming a tree of processes.
fork() system call creates a new process.

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 60


Parent process calls wait()waiting for the child to terminate.
Process executes last statement and then asks the operating system to delete it
using the exit() system call.
Google Chrome Browser is multi-process with 3 different types of Processes
A process cooperating is if it does not share data with any other processes
executing in the system.
A independent process can affect or be affected by other processes executing in
the system, including sharing data.
Cooperating processes don’t need interprocess communication (IPC) mechanism
Message passing: A region of memory that is shared by the cooperating processes
is established.
Shared memory: Communication takes place by means of messages exchanged
between the cooperating processes.
Shared Memory:It can be faster than message passing,
The producer process has a local variable next_consumed in which the new item to
be produced is stored.
The consumer process has a local variable next_produced in which the item to be
consumed is stored.
The buffer is full when in == out.
The buffer is empty when ((in + 1) % BUFFER SIZE) == out.
The variable in points to the next free position in the buffer.
The variable out points to the first full position in the buffer.
consumer process produces information that is consumed by a Producer process.
Threads creation and termination is the main responsibility of kernel.
In Bounded-buffer Producer never waits
The UNIX less command produces a directory listing.
The command ls manages output by displaying only one screen of output at a time
The ls command serves as the producer, and its output is consumed by the less command.
The FCFS scheduling algorithm is preemptive.
The implementation of FCFS policy is easily managed with a queue.
Convoy effect - short process behind long process.
SJF is optimal – it gives the minimum average waiting time for a given set of processes.
It is desirable to minimize CPU utilization and throughput and to maximize
turnaround time, waiting time, and response time.
After this time has elapsed in RR, the process is preempted and added to the start
of the ready queue.
In RR higher average turnaround than SJF, but better response.

With My Best Wishes Eng Ihap EL-Galaly 01062665758 Page 61

You might also like