1 - Introduction To Os
1 - Introduction To Os
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:
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:
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.