PDF document-4588E141BC5B-1
PDF document-4588E141BC5B-1
PDF document-4588E141BC5B-1
Course Outcomes
⚫ CO1: Understand operating system functions, structure and
processes.
⚫ CO2: Apply process scheduling algorithms , synchronization
mechanisms and deadlock handling techniques to allocate
resources effectively.
⚫ CO3: Interpret various memory management techniques in
operating systems.
⚫ CO4: Understand file system and storage management
methods in Operating system.
What is an Operating System
• A modern computer consists of:
One or more processors
Main memory
Disks
Printers
Various input/output devices.
• Managing all these varied components
requires a layer of software – the
Operating System (OS).
What is an Operating System
⚫ An Operating System is a program that acts as an
intermediary/interface between a user of a computer and the
computer hardware.
⚫ OS goals:
⚫ Control/execute user/application programs.
⚫ Make the computer system convenient to use.
⚫ Ease the solving of user problems.
⚫ Use the computer hardware in an efficient manner.
What is an Operating System
⚫ In a more simplistic approach, in fact, OS itself is a program.
⚫ But it has a priority which application programs don’t have.
⚫ OS uses the kernel mode of the microprocessor, whereas
other programs use the user mode.
⚫ The difference between two is that; all hardware instructions
are valid in kernel mode, where some of them cannot be used
in the user mode.
Where does the OS fit in?
Four Components of a Computer System
(Computer System Structure)
Computer System Structure
⚫ Computer system can be divided into four components
⚫ Hardware
⚫ provides basic computing resources
⚫ CPU, memory, I/O devices.
⚫ Operating system
⚫ Controls and coordinates use of hardware among various
applications and users.
⚫ Windows, Mac OS, Android, Linux
⚫ Application programs
⚫ Define the ways in which the system resources are used to solve
the computing problems of the users.
⚫ Word processors, web browsers, database systems, video
games
⚫ Users
⚫ People, machines, other computers
Functions of an Operating System
⚫ I/O Management
⚫ Process Management
⚫ Memory Management
⚫ Storage Management
⚫ Protection and Security
I/O Management
⚫ One of the purposes of an operating system is to hide the
peculiarities of specific hardware devices from the user.
⚫ Every operating systems has an I/O subsystem for managing
its I/O devices.
Process Management
⚫ A process is program in execution.
Eg: A word-processing program being run by an individual user
on a PC
⚫ A process needs certain resources to accomplish its task.
⚫ CPU time
⚫ memory
⚫ files
⚫ I/O devices.
⚫ These resources are either given to the process when it is
created or allocated to it while it is running.
Process Management
⚫ The operating system is responsible for the following process
management activities :
⚫ Scheduling processes and threads on the CPUs
⚫ Creating and deleting both user and system processes
⚫ Suspending and resuming processes
⚫ Providing mechanisms for process synchronization
⚫ Providing mechanisms for process communication
Memory Management
⚫ Main memory is the only large storage device that the CPU is
able to address and access directly.
⚫ For a program to be executed, it must be mapped to absolute
addresses and loaded into memory.
⚫ As the program executes, it accesses program instructions and
data from memory by generating these absolute addresses.
⚫ When the program terminates, its memory space is declared
available, and the next program can be loaded and executed.
⚫ To improve both the utilization of the CPU and the speed of the
computer’s response to its users, general-purpose computers
must keep several programs in memory, creating a need for
memory management.
Memory Management
⚫ The operating system is responsible for the following memory
management activities :
⚫ Keeping track of which parts of memory are currently being
used and who is using them
⚫ Deciding which processes (or parts of processes) and data
to move into and out of memory
⚫ Allocating and deallocating memory space as needed
Storage management-File-System
Management
Files represent programs (both source and object forms) and data.
Data files may be numeric, alphabetic, alphanumeric, or binary.
The operating system is responsible for the following file
management activities
⚫ Creating and deleting files
⚫ Creating and deleting directories to organize files
⚫ Supporting primitives for manipulating files and directories
⚫ Mapping files onto secondary storage
⚫ Backing up files on stable (non-volatile) storage media
Storage management-Mass Storage Management
⚫ Main memory is too small to accommodate all data and
programs, and because the data that it holds are lost when
power is lost, the computer system must provide secondary
storage to back up main memory.
⚫ Most modern computer systems use disks as the principal
on-line storage medium for both programs and data.
⚫ The operating system is responsible for the following activities
in connection with disk management:
• Free-space management
• Storage allocation
• Disk scheduling
Storage management-Caching:
⚫ Information is normally kept in some storage system (such as
main memory).
⚫ As it is used, it is copied into a faster storage system ,the cache
on a temporary basis.
⚫ When we need a particular piece of information, we first check
whether it is in the cache. If it is, we use the information
directly from the cache.
⚫ If it is not, we use the information from the source, putting a
copy in the cache under the assumption that we will need it
again soon.
Storage management-Caching:
Instruction Cache
⚫ Most systems have an instruction cache to hold the instructions
expected to be executed next.
⚫ Without this cache, the CPU would have to wait several cycles
while an instruction was fetched from main memory.
Data Cache
⚫ Most systems have one or more high-speed data caches in the
memory hierarchy.
Storage management-Caching:
⚫ Because caches have limited size, cache management is an
important design problem.
Storage management-Caching:
⚫ In a hierarchical storage structure, the same data may appear in
different levels of the storage system.
⚫ For example, suppose that an integer A that is to be
incremented by 1 is located in file B, and file B resides on
magnetic disk.
⚫ The increment operation proceeds by first issuing an I/O
operation to copy the disk block on which A resides to main
memory.
⚫ This operation is followed by copying A to the cache and to an
internal register.
⚫ Thus, the copy of A appears in several places: on the magnetic
disk, in main memory, in the cache, and in an internal register
⚫ Once the increment takes place in the internal register, the
value of A differs in the various storage systems.
Storage management-Caching:
⚫ The value of A becomes the same only after the new value of A is
written from the internal register back to the magnetic disk.
⚫ In a multitasking environment, where the CPU is switched back and
forth among various processes ,if several processes wish to access
A, then each of these processes will obtain the most recently updated
value of A.
⚫ In a multiprocessor environment where, in addition to maintaining
internal registers, each of the CPUs also contains a local cache .
⚫ In such an environment, a copy of A may exist simultaneously in
several caches.
⚫ Since the various CPUs can all execute in parallel, we must make
sure that an update to the value of A in one cache is immediately
reflected in all other caches where A resides.
⚫ This situation is called cache coherency, and it is usually a
hardware issue .
Storage management-Caching:
Multiprocessor Systems
⚫ Two or more processors in close communication, sharing the
computer bus and sometimes the clock, memory, and
peripheral devices.
Multiprocessor systems have three main advantages:
1. Increased throughput
⚫ By increasing the number of processors, more work done in
less time.
⚫ The speed-up ratio with N processors is not N, however;
rather, it is less than N.
⚫ When multiple processors cooperate on a task, a certain amount
of overhead is incurred in keeping all the parts working
correctly.
⚫ Contention for shared resources also, lowers the expected gain
from additional processors
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
If functions can be distributed properly among several processors,
then the failure of one processor will not halt the system, only
slow it down.
If we have ten processors and one fails, then each of the remaining
nine processors can pick up a share of the work of the failed
processor. Thus, the entire system runs only 10 percent slower,
rather than failing altogether.
⚫ The ability to continue providing service proportional to the
level of surviving hardware is called graceful degradation.
⚫ Fault tolerance is the property that enables a system to continue
operating properly in the event of the failure of (or one or more
faults within) some of its components.
⚫ The multiple-processor systems in use today are of two types.
Asymmetric multiprocessing
⚫ Each processor is assigned a specific task.
⚫ A boss processor controls the system; the other processors
either look to the boss for instruction or have predefined tasks.
⚫ This scheme defines a boss–worker relationship.
⚫ The boss processor schedules and allocates work to the worker
processors.
Symmetric multiprocessing (SMP)
⚫ Each processor performs all tasks within the operating system.
⚫ All processors are peers; no boss–worker relationship exists
between processors.