0% found this document useful (0 votes)
7 views11 pages

Midterms Operating Systems

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

Midterms Operating Systems

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

Acronyms: ● A text based user interface

GUI - Graphical User Interface displays text, and its


MM - Main Memory commands are usually typed on
FCFS - First-Come First Served a command line using a
SM - Secondary Memory keyboard.
SPF - Shortest Process First
CPU - Central Processing Unit ● would allow users to enter and
SJF - Shortest Job First receive output and input.
RAM - Random Access Memory
P - Priority ● Graphical user interface (icons)
UI - User Interface
SRTF - Shortest Remaining Time First ● command line interface a way
I/O - Input/Output to interact with a computer by
RR - Round-Robin entering text commands.
PID - Process Identification
MFQ - Multilevel Feedback Queue ● menu driven interface is a
PCB - Process Control Block user interface that uses a
ATT - Average Turnaround Time series of menus to allow users
T - Throughput to interact with a system or
AWT - Average Waiting Time program.
TT - Turnaround Time
Operating Systems Lesson 4 ● web form interface a digital
RT - Response Time (Services Provided by OS) form on a web page that
allows users to input data or
WT - Waiting Time (1) User Interface interact with a website.

P - Preemptive ● refers to the part of an ● voice activated interface a


operating system, program, or system that allows users to
NP - Non Preemptive device that allows a user to interact with devices or
enter and receive applications by speaking
Q - Quantum information. commands.
(2) Program Execution ● The OS provides an interface (5) Resource Allocation
to the user to create/delete
● It is the OS that manages how files and directories. It ● Resource allocation is the
a program is going to be provides an interface to create process by which a computing
executed. the backup of the file system. system aims to meet the
hardware requirements of an
● It loads the program into the ● When you write a program, all application run by it.
memory after which it is the files and records and
executed. database are manipulated on ● Computing, networking and
the operating system. energy resources must be
● part of abstraction. optimized taking into account
hardware, performance and
● The order in which they are environmental restrictions.
executed depends on the CPU
Scheduling Algorithms. ● memory is allocated.
(4) I/O Operations
● OS load program in the ● OS ensures that all resources
memory. ● Input-output (I/O) systems needed are allocated with the
transfer information between data before going to CPU (ex.
● OS managed the transfer from Program that needs wifi, checks
second memory to main ● An I/O system is composed of if there is WiFi).
memory to CPU. I/O devices (peripherals), I/O
control units, and software to ● Scheduler decides which
carry out the I/O program to enter the CPU.
(3) File Manipulation transaction(s) through a
sequence of I/O operations. ● dispatcher (operating system).
● OS gives the permission to
the program for operation on ● it stands by information ● OS ensures that there will be
file. This permission varies between the memory and the no starvation and deadlock.
from read-only, read-write, outside world. Ex hard drive,
denied and so on. USB.
(6) Error Detection zero, overflow in the control
register etc. (8) Protection and Security
● Errors can occur anytime and
anywhere in the operating ● Error can happen on IO, ● Operating systems manage
system. An error can occur in memory. both logical and physical
CPU, in I/O devices or in the resources to prevent
memory hardware. ● The OS detects and corrects interference with each other
the errors on its own. and unauthorized access
● The Operating System from external sources.
constantly checks for (7) Accounting
possible errors. ● These methods are
● audit trail categorized as protection and
● The Operating System takes security in the operating
an appropriate action to ● Accounting consists of keeping system. Computing
ensure correct and track of the behavior of both resources, such as CPUs,
consistent computing. users and processes in the disks, and memory, are
computing system. secured and protected by
● OS detects errors during this management.
program execution at all ● For instance, the operating
times to maintain data system analyzes which users ● This can be accomplished by
integrity. require the execution of assuring the operating
which processes. system's confidentiality,
● Errors may be caused by availability, and integrity.
programs,computer ● investigate how many
architecture, physical computer resources are ● Unauthorized access,
limitations, power supply needed. viruses, worms, and other
systems, and attackers. threats must be prevented
● So, it can also investigate how from entering the system.
● Examples of errors trying to many computing resources
write data in the write-protect are requested by the ● Protection prevents viruses
section of memory, divide by processes executing on the (internal threats) .
computer.
● Security prevents virus ● Linker: binding time so not all
entering (external threats). you need to load.

● One line command use


(9) Command Interpretation interpreter and command in
the program needs compiler
● A command interpreter is a
system software that (10) Resource Manager
understands and executes
commands that are entered ● An operating system collects
interactively by a human or all the resources in the
from another program. network environment and
allocates the resources to
● Command interpreters are an efficiently request the process.
important part of any To do this efficiently OS acts
operating system. It provides as a Resource Manager.
an interface between the user
and the computer. ● Resource managers are
● Translators: interpreter, typically responsible for
compiler. presenting an interface to
various types of devices.
● Source code: written high
language code. ● This may involve managing
actual hardware devices (like
● Compiler: translates the serial ports, parallel ports,
program . network cards, and disk drives)
or virtual devices.
● Object code: output, after
compilation

● Loader: compiles into library


Operating Systems Lesson 5 ● REMEMBER: A process can (E.g. Flash Drive, Storage,
(Process Management) only create another process Hard Drive.)
only in the CPU
Ready State (Main Memory)
Process management Thread
● The process is ready to run and
● involves tasks related to ● is the unit of execution within is waiting to get the CPU time
processing like creation, a process. for its execution. (E.g. RAM)
scheduling, termination,
deadlock, etc. Process Control Block Running State (CPU)

● The OS allocates resources ● acts as a repository that may ● The process is chosen from the
that allow the process to vary from process to process. ready queue by the OS for
exchange information. execution. (E.g. CPU)
● a record containing many
● It synchronizes among pieces of information Block/Wait State
processes and safeguards the associated with a specific
resources of other processes. process. ● Whenever the process
requests access to I/O needs
Process Free Hole input from the user or needs
access to a critical region.
● is a unique execution of a ● Free space in the main
program with specific set memory. ● Once the I/O operation is
data. completed the process goes to
the ready state.
● can be thought of as a Process State Diagram
program in execution. Terminated/Completed State
New State (Secondary Memory)
● A process can have anywhere ● Process is killed as well as the
from just one thread to ● The process is about to be PCB is deleted. The resources
multiple. created but not yet created. allocated to the process will be
released or deallocated.
Interrupt Descendant - child of the child of the Abnormal Termination
child’s node ● forced termination of the
● There's an I/O request. process by the OS due to some
Sibling - shared the same parent. unrecoverable error.
Preempt
One Precedence Graph - is called a Reason for a parent to terminate the
● Transition from running to tree. execution of one of its children:
ready.
Forest - more than one tree. ● The child has exceeded its
PCB (Buffer) usage of some of the resources
Terminal Nodes - nodes with no it has been allocated.
● Only created when a process children. Is also called a leaf.
is in the ready state. (Main ● The task assigned to the child
Memory) Root - called the first node. is no longer required.

Operations on Processes When a process creates a new


process, two common implementation
1. Process Creation exists in terms of execution:
2. Process Termination
● The parent continues to
Process Creation execute concurrently with its
children.
Parent - calls. Child - called.
● The parent waits until its
Grandparent - parents of the parent’s children have terminated.
node
Process Termination
Grandchild - child of the child’s node.
Normal Termination
Ancestor - parent of the parent of the ● a call by a process to a
parent’s node. termination statement.
Operating Systems Lesson 6 Ready Queue ● The process could create
(Process Scheduling) another process and wait for
● Process in main memory. the latter’s termination.
Process Scheduling
● The processes that are ● The process could be
● the activity of the process residing in main memory and removed from the CPU
manager that handles the are ready and waiting to temporarily due to an
removal of the running execute are kept on a list interrupt, if the time slice
process from the CPU and the called the ready queue. allocated to it expires.
selection of another process
on the basis of a particular ● processes that are residing in Process Schedulers
strategy. the main memory awaiting
allocation of the CPU are Long-term schedulers
● an essential part of a placed. (Job Schedulers)
multiprogramming operating
system. Device Queue ● many-to-many, decides which
processes are loaded into
Job Queue ● In the block state, a process memory.
that is from running to block.
● All processes in the Short-term schedulers
secondary memory are ● The list of processes waiting (CPU Schedulers)
waiting for allocation of main for a particular I/O device.
memory. ● many-to-one, selects which
Process Scheduling process will execute on the
● As processes enter the CPU.
system, they are put into a job Once the process is in the CPU, one of
queue, which consists of all the several events could occur: ● The moment the CPU is idle, it
processes in the system. has to immediately decide
● The process could issue an which among the processes.
● where the process is placed I/O request, and then be
as it moves into the system; placed on an I/O device
queue.
CPU scheduling may be classified ❑ Throughput (T) – number of
as: processes completed per unit of
time (higher).
➢Non-preemptive scheduling [NP]
❑ Turnaround Time (TT) – time
● CPU scheduling is between the submission of process
non-preemptive if once the to the time of completion (lower).
CPU has been assigned to a
process and the process ❑ Response Time (RT) – time from
starts executing, the CPU the submission of process until the
cannot be taken away from first response is produced (lower).
that process.
❑ Waiting Time (WT) - time spent to
➢Preemptive scheduling [P] get into the memory and time spent in
the ready queue (lower).
● In preemptive CPU scheduling,
even though the CPU has been
assigned to a process and the
process is already executing,
the CPU scheduler may
decide to assign the CPU to
another process in the ready
queue.

A good scheduler should optimize the


following performance criteria:

❑ CPU Utilization (CPU%) - ratio of


computing time over the total time
used (higher).
Operating Systems Lesson 7 ● So in order to minimize this produces the first response should
(Process Scheduling) excess, the OS needs to be as less as possible.
schedule tasks in order to CPU Scheduling Algorithms:
CPU Scheduling make full use of the CPU and
avoid the possibility of First-Come First Served (FCFS) CPU
● is the process of deciding deadlock. Scheduling Algorithm
which process will own the
CPU to use while another Objectives of CPU Scheduling ● Non-preemptive
process is suspended. Algorithm
● states that the process that
● The main function of the CPU ✓ Utilization of CPU at maximum requests the CPU first is
scheduling is to ensure that level. Keep the CPU as busy as allocated the CPU first. It is
whenever the CPU remains possible. implemented by using the FIFO
idle, the OS has at least queue.
selected one of the ✓ Allocation of CPU should be fair.
processes available in the Shortest Process First (SPF) CPU
ready-to-use line. ✓ Throughput should be Maximum. Scheduling Algorithm
i.e. Number of processes that
● In multiprogramming, if the complete their execution per time
long-term scheduler selects unit should be maximized. ● Nonpreemptive
multiple I/O binding
processes then most of the ✓ Minimum turnaround time, i.e. ● Also known as Shortest Job
time, the CPU remains idle. time taken by a process to finish First (SJF)
The function of an effective execution should be the least.
program is to improve ● The scheduler selects the
resource utilization. ✓ There should be a minimum process with the lowest CPU
waiting time and the process should burst time or the lowest time
● If most operating systems not starve in the ready queue. to finish.
change their status from
performance to waiting then ✓ Minimum response time. It means
there may always be a chance that the time when a process
of failure in the system.
Priority (P) CPU Scheduling Round-Robin (RR) CPU Scheduling Shortest Remaining Time First
Algorithm Algorithm (SRTF) CPU Scheduling Algorithms

● Nonpreemptive ● Preemptive ● Preemptive

● It is used in OS for performing ● It is the oldest scheduling ● is a preemptive version of the


batch processes. algorithm, which is mainly shortest job next scheduling.
used for multitasking.
● A number is assigned to each ● In this scheduling algorithm, the
process that indicates its ● First come, First Serve CPU process with the smallest
priority level. Scheduling algorithm where amount of time remaining
each process in the ready state until completion is selected
● The larger priority number will gets the CPU for a fixed time to execute.
come first. in a cyclic way (Time Slice).

● If two jobs having the same


priority are READY, it works on Multilevel Feedback Queue (MFQ)
a FIRST COME, FIRST CPU Scheduling Algorithms
SERVED basis.
● Preemptive

● processes are assigned to a


queue on entry to the system
and processes are allowed to
move between queues.

● As the processes are


permanently assigned to the
queue, this setup has the
advantage of low scheduling
overhead.
Step-by-Step on Getting the ATT and Turnaround Time - RIGHT (0 + 6 + 9 + 14) / 4
AWT:
So: AWT = 7.25 ms
Process CPU Burst Time Priority
P1 = 6
P1 6 ms 3 P2 = 9
P3 = 14
P2 3 ms 4 P4 = 18
P3 5 ms 2
To get Average Turn Around Time is to
p4 4 ms 1 get the sum of Turn Around time and
divide it to how many the process.
(Reminder: The Gantt Chart varies
from different Scheduling (6 + 9 +14 + 18) / 4
Algorithm)
ATT = 11.75 ms
Gantt Chart
Waiting Time - LEFT
Process
So:
P1 P2 P3 P4

0 6 9 14 18 P1 = 0
P2 = 6
Burst Time P3 = 9
P4 = 14
Always start with 0 and add the burst
time as the process continues. To get the Average Waiting Time is to
get the sum of the Waiting Time of the
The total of the process time should be process and divide it to how many the
equal to the CPU Burst Time total. process.

You might also like