100% found this document useful (1 vote)
51 views20 pages

Chapter 2 Design Principles

The document discusses several design principles and concepts related to operating systems, including caching, virtualization, and concurrency as key design principles. It covers topics such as the functionalities of typical operating systems, design issues, structuring methods, application programming interfaces, interrupts and their role, dispatching and context switching, and concurrent execution.

Uploaded by

abel sintayehu
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
100% found this document useful (1 vote)
51 views20 pages

Chapter 2 Design Principles

The document discusses several design principles and concepts related to operating systems, including caching, virtualization, and concurrency as key design principles. It covers topics such as the functionalities of typical operating systems, design issues, structuring methods, application programming interfaces, interrupts and their role, dispatching and context switching, and concurrent execution.

Uploaded by

abel sintayehu
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 20

Chapter 2

Design Principles

04/23/2024 School of Computing, DDUIoT 1


Contents
o Basic design principles
o Functionalities of typical OS
o The design issues of OS
o Structuring methods in OS
o Application programming interface
o Interrupts and the role of interrupts
o Dispatching and context switching
o Concurrent execution
o Models and synchronization mechanisms in OS
o Producer consumer problems
o Multiprocessor issues

04/23/2024 School of Computing, DDUIoT 2


Basic Design Principles
 There is no specific way to design an operating system
as it is a highly creative task.
 However, there are general software principles that are
applicable to all operating systems. A subtle difference
between mechanism and policy is that mechanism
shows how to do something and policy shows what to
do
 The three important design principles in operating
systems are:
o caching,
o virtualization, and
o support for concurrency.
o Caching is a key design principle in operating systems
that involves storingSchoolfrequently
04/23/2024 of Computing, DDUIoT
accessed data in a fast-
3
access memory location.
Functionalities of OS
The basic functions of operating system includes:
o Security
o Control over System Performance
o Job Accounting
o Error Detecting Aids
o Coordination between Users and Other Software
o Memory Management
o Process Management
o Device Management ...

04/23/2024 School of Computing, DDUIoT 4


Design issues of OS
Understanding the different types of advanced operating systems to
understand the major design issues better.
The important issues related to Operating system are functions of
Operating system are:
Transparency: Multiple computers are used but the user gets a view of
only single system being used. Makes the network invisible to
user/applications.
Flexibility: Flexible operating systems are taken to be those whose
designs have been motivated to some degree by the desire to allow
the system to be tailored, either statically or dynamically, to the
requirements of specific applications or application domains.
Reliability: In general, reliability is the ability of a person or system
to perform and maintain its functions in routine circumstances, as well
as hostile or unexpected circumstances. Also, an operating system may
be extremely reliable at one kind of task and extremely unreliable at
another. Current operating systems have two characteristics that make
them unreliable and insecure.
04/23/2024 School of Computing, DDUIoT 5
Design issues of OS (Cont ...)
Performance: It is rather difficult to establish an objective performance
metric for software as complex as an operating system: a "faster OS" is a
very subjective, context dependent phrase.
 Scale-ability: is a desirable property of a system, a network, or a
process, which indicates its ability to either handle growing amounts of
work in a graceful manner, or to be readily enlarged.
 Naming: The resources in a distributed system are spread across
different computers and a naming scheme has to be devised so that
users can discover and refer to the resources that they need.
 Replication: Whether one replicates data or computation, the objective
is to have some group of processes that handle incoming events.
 Synchronization: Processes requires coordination to achieve
synchronization. Process must reach a common synchronization point
before they can continue.
 Security: includes Authentication, authorization and other techniques.

04/23/2024 School of Computing, DDUIoT 6


Structuring Methods in OS

g
Different Approaches or Structures of Operating

! in
Systems

em ow
 Simple/Monolithic Structure.

st ll
sy f o
 Micro-Kernel Structure.

g nt,
 Hybrid-Kernel Structure.

tin e
ra n m
 Exo-Kernel Structure.

p e s ig
 Layered Structure.
 f o as
Modular Structure.
s o of
 Virtual Machines.
pe n
ty tio
es
qu
2 nd

04/23/2024 School of Computing, DDUIoT 7


Application Programming Interface
 An application programming interface (API) is code that
enables two software programs to communicate.
 An API defines how a developer should request services
from an operating system (OS) or other application, and
expose data within different contexts and across multiple
channels.
 An API, or application programming interface, is a set of
defined rules that enable different applications to
communicate with each other.
 It acts as an intermediary layer that processes data transfers
between systems, letting companies open their application data
and functionality to external third-party developers, business
partners, and internal departments within their companies.
04/23/2024 School of Computing, DDUIoT 8
Interrupt
 An interrupt is a signal generated by either hardware
devices or software components to interrupt the normal
execution of a program and request immediate attention
from the operating system. This mechanism allows
devices and software to communicate with the operating
system asynchronously and notify it about specific
events or requests without continuously polling or
waiting for a response. May be
Planned: specifically requested by the the current
running programs
Unplanned: caused by an event that might or might not
be related to the currently running program
 Also classified as hardware and software interrupts.
04/23/2024 School of Computing, DDUIoT 9
Interrupt (Cont...)
 When an i/o device has finished the work given to it, it
causes an interrupt
 It does this by asserting a signal on a bus line that it
has been assigned.
 This signal is detected by the interrupt controller chip
on the parent board, which then decides what to do.
 If no other interrupts are pending, the interrupt
controller processes the interrupt immediately.
 If another one is in progress, or another device has
made a simultaneous request on a higher-priority
interrupt request line on the bus, the device is just
ignored for the moment.
 In this case it continues to assert an interrupt signal on
the bus until it is serviced by the CPU.
04/23/2024 School of Computing, DDUIoT 10
Interrupt (Cont...)
 To handle the interrupt:
 The controller puts a number on the address lines
specifying which device wants attention and asserts a
signal to interrupt the CPU.
 New program counter is fetched from tabled called
interrupt vector using the number on the address lines
is used as an index into this table.
 Interrupt service procedure is start running and finally
acknowledges the interrupt by writing a certain value to
one of the interrupt controller's I/0 ports.

04/23/2024 School of Computing, DDUIoT 11


The Role of Interrupts
 Interrupts are commonly used to service hardware
timers, transfer data to and from storage (e.g., disk
I/O) and communication interfaces (e.g., UART,
Ethernet), handle keyboard and mouse events, and to
respond to any other time-sensitive events as required
by the application system.
 An interrupt is a signal emitted by a device attached to
a computer or from a program within the computer. It
requires the operating system (OS) to stop and figure
out what to do next.
 An interrupt temporarily stops or terminates a service
or a current process.

04/23/2024 School of Computing, DDUIoT 12


Dispatching and Context Switching
 The Context switching is a technique or method used
by the operating system to switch a process from one
state to another to execute its function using CPUs in
the system.
 When switching perform in the system, it stores the old
running process's status in the form of registers and
assigns the CPU to a new process to execute its tasks.
 While a new process is running in the system, the
previous process must wait in a ready queue. The
execution of the old process starts at that point where
another process stopped it.

04/23/2024 School of Computing, DDUIoT 13


Dispatching and Context Switching
 It defines the characteristics of a multitasking operating
system in which multiple processes shared the same
CPU to perform multiple tasks without the need for
additional processors in the system.
 To communicate thread and process states in computing
and task execution, the system uses context switching
and dispatching.
 Context switching helps the system store thread and
process state, so that it can switch between tasks which
need execution.
 Dispatching handles which tasks get resources at which
point in time

04/23/2024 School of Computing, DDUIoT 14


Concurrent Execution
 Concurrency is the execution of a set of multiple
instruction sequences at the same time. This occurs
when there are several process threads running in
parallel. These threads communicate with the other
threads/processes through a concept of shared memory
or through message passing
 The execution of a concurrent program consists of
multiple processes active at the same time.
 Each process is the execution of a sequential program.
 A process progresses by submitting a sequence of
instructions to a processor for execution.

04/23/2024 School of Computing, DDUIoT 15


Models and Synchronization Mechanisms in OS
o Coordinating the execution of processes so that no two
processes access the same shared resources and data is
known as process synchronization.
o It is necessary for a multi-process system where several
processes coexist and concurrently attempt to access the
same shared resource or piece of data
o Higher level mechanisms to solve common
synchronization problems include:
o Semaphores are just normal variables used to coordinate
the activities of multiple processes in a computer
system. They are used to enforce mutual exclusion,
avoid race conditions, and implement synchronization
between processes. The process of using Semaphores
provides two operations: wait (P) and signal (V).
04/23/2024 School of Computing, DDUIoT 16
Models and Synchronization Mechanisms in OS(Cont..)
o Monitors are a programming language component that aids
in the regulation of shared data access.
o The Monitor is a package that contains shared data
structures, operations, and synchronization between
concurrent procedure calls.
o Condition variables: are synchronization primitives that
enable threads to wait until a particular condition occurs.
Condition variables are user-mode objects that cannot be
shared across processes.
o Rendezvous occurs when two processes synchronize and
subsequently exchange messages. Rendezvous is symmetric,
in that processes that wish to communicate both use the
same primitive; and processes invoke Rendezvous with class
designations, not procedure names.
04/23/2024 School of Computing, DDUIoT 17
Producer-Consumer Problems
o Problem: There is a set of resource buffers shared by
producer and consumer threads
o Producer inserts resources into the buffer set
◆ Output, disk blocks, memory pages, processes, etc.
o Consumer removes resources from the buffer set
◆ Whatever is generated by the producer
o Producer and consumer execute at different rates
◆ No serialization of one behind the other
◆ Tasks are independent (easier to think about)
◆ The buffer set allows each to run without explicit
handoff.

04/23/2024 School of Computing, DDUIoT 18


Multiprocessor issues(Spin-locks, reentrancy)
o In multiprocessing, we use more than one processor, which
executes several sets of instructions in parallel. More than one
CPU is required. More than one job is performed at a time.
o Spin-lock is a synchronization mechanism used in operating
systems to protect shared resources from single access by
multiple threads or processes.
o Unlike other synchronization methods such as semaphores or
mutexes, spinlocks use a busy-wait method, where a thread
continuously selects a lock until it becomes available.
o A computer program or subroutine is called re-entrant if
multiple invocations can safely run concurrently on multiple
processors, or if on a single-processor system its execution can
be interrupted and a new execution of it can be safely started
(it can be "re-entered").

04/23/2024 School of Computing, DDUIoT 19


04/23/2024 School of Computing, DDUIoT 20

You might also like