OS UNIT-I
OS UNIT-I
OS UNIT-I
me/jntuh
Operating System
UNIT - I
Operating System - Introduction, Structures -
Simple Batch, Multiprogrammed, Time-shared,
Personal Computer, Parallel, Distributed
Systems, Real-Time Systems, System
components, Operating System services,
System Calls
Loader –
A Loader is a routine that loads an object program and
prepares it for execution. There are various loading
schemes: absolute, relocating and direct-linking. In
general, the loader must load, relocate and link the
object program. The loader is a program that places
programs into memory and prepares them for
execution. In a simple loading scheme, the assembler
outputs the machine language translation of a program
on a secondary device and a loader places it in the
core. The loader places into memory the machine
language version of the user’s program and transfers
control to it. Since the loader program is much smaller
than the assembler, those make more core available to
the user’s program.
Advantages of RTOS:
• Maximum Consumption: Maximum utilization of devices
and system, thus more output from all the resources
• Task Shifting: The time assigned for shifting tasks in these
systems are very less. For example, in older systems, it
takes about 10 microseconds in shifting one task to
another, and in the latest systems, it takes 3 microseconds.
• Focus on Application: Focus on running applications and
less importance to applications which are in the queue.
• Real-time operating system in the embedded system:
Since the size of programs are small, RTOS can also be used
in embedded systems like in transport and others.
• Error Free: These types of systems are error-free.
• Memory Allocation: Memory allocation is best managed in
these types of systems.
Disadvantages of RTOS:
• Limited Tasks: Very few tasks run at the same time and
their concentration is very less on few applications to avoid
errors.
• Use heavy system resources: Sometimes the system
resources are not so good and they are expensive as well.
• Complex Algorithms: The algorithms are very complex and
difficult for the designer to write on.
• Device driver and interrupt signals: It needs specific device
drivers and interrupts signals to respond earliest to
interrupts.
• Thread Priority: It is not good to set thread priority as
these systems are very less prone to switching tasks.
Examples of Real-Time Operating Systems are: Scientific
experiments, medical imaging systems, industrial control
systems, weapon systems, robots, air traffic control
systems, etc.
9. Parallel Systems:
Parallel operating systems (also tightly coupled systems) are supposed to
be used in machines with more than one processor connected closely
where these multiple processors will be sharing memory, clock, buses
and other peripherals. Parallel systems are designed to distribute a job
to multiple processors to have faster speed.
But the speed-ratio is for n processor is not n the times for a single
processor. As, when multiple processors cooperate on a task, a certain
amount of overhead is incurred in keeping all the parts working
correctly.
Different model of parallel systems exists, such as symmetric-
multiprocessing model where each processors runs a copy of the
operating system, these operating systems communicate each other
when required.
Another model is asymmetric-multiprocessing where each processors get
a specific task to do.
A master processor controls other processors and maintain the workflow.
This is a master-slave situation where slaves’ checkout for tasks from
masters or sit idle.
File Management
• A file is a set of related information which is
should define by its creator. It commonly
represents programs, both source and object
forms, and data. Data files can be numeric,
alphabetic, or alphanumeric.
Function of file management in OS:
• The operating system has the following important
given activities in connections with file
management:
• File and directory creation and deletion.
• For manipulating files and directories.
• Mapping files onto secondary storage.
• Backup files on stable storage media.
Process Management
• The process management component is a procedure for managing the
many processes that are running simultaneously on the operating system.
Every software application program has one or more processes associated
with them when they are running.
• For example, when you use a browser like Google Chrome, there is a
process running for that browser program. The OS also has many
processes running, which performing various functions.
• All these processes should be managed by process management, which
keeps processes for running efficiently. It also uses memory allocated to
them and shutting them down when needed.
• The execution of a process must be sequential so, at least one instruction
should be executed on behalf of the process.
Functions of process management in OS:
• The following are functions of process management.
• Process creation and deletion.
• Suspension and resumption.
• Synchronization process
• Communication process
Network Management
• Network management is the process of administering and managing computer
networks. It includes performance management, fault analysis, provisioning of
networks, and maintaining the quality of service.
• A distributed system is a collection of computers/processors that never share their
own memory or a clock. In this type of system, all the processors have their local
Memory, and the processors communicate with each other using different
communication lines, like fiber optics or telephone lines.
• The computers in the network are connected through a communication network,
which can be configured in a number of different ways. With the help of network
management, the network can be fully or partially connected, which helps users to
design routing and connection strategies that overcome connection and security
issues.
Functions of Network management:
• Distributed systems help you to various computing resources in size and function.
They may involve microprocessors, minicomputers, and many general-purpose
computer systems.
• A distributed system also offers the user access to the various resources the
network shares.
• It helps to access shared resources that help computation to speed-up or offers
data availability and reliability.
Secondary-Storage Management
• The most important task of a computer system is to execute
programs. These programs, along with the data, helps you to
access, which is in the main memory during execution.
• This Memory of the computer is very small to store all data and
programs permanently. The computer system offers secondary
storage to back up the main Memory. Today modern computers use
hard drives/SSD as the primary storage of both programs and data.
However, the secondary storage management also works with
storage devices, like a USB flash drive, and CD/DVD drives.
• Programs like assemblers, compilers, stored on the disk until it is
loaded into memory, and then use the disk as a source and
destination for processing.
Functions of Secondary storage management in OS:
• Here, are major functions of secondary storage management in OS:
• Storage allocation
• Free space management
• Disk scheduling
Security Management
• The various processes in an operating system need to
be secured from each other's activities. For that
purpose, various mechanisms can be used to ensure
that those processes which want to operate files,
memory CPU, and other hardware resources should
have proper authorization from the operating system.
• For example, Memory addressing hardware helps you
to confirm that a process can be executed within its
own address space. The time ensures that no process
has control of the CPU without renouncing it.
• Lastly, no process is allowed to do its own I/O, to
protect, which helps you to keep the integrity of the
various peripheral devices.
Program execution
• Operating systems handle many kinds of activities from
user programs to system programs like printer spooler,
name servers, file server, etc. Each of these activities is
encapsulated as a process.
• A process includes the complete execution context (code to
execute, data to manipulate, registers, OS resources in use).
Following are the major activities of an operating system
with respect to program management −
• Loads a program into memory.
• Executes the program.
• Handles program's execution.
• Provides a mechanism for process synchronization.
• Provides a mechanism for process communication.
• Provides a mechanism for deadlock handling.
I/O Operation
• An I/O subsystem comprises of I/O devices and
their corresponding driver software. Drivers hide
the peculiarities of specific hardware devices
from the users.
• An Operating System manages the
communication between user and device drivers.
• I/O operation means read or write operation with
any file or any specific I/O device.
• Operating system provides the access to the
required I/O device when required.
Communication
• In case of distributed systems which are a collection of processors
that do not share memory, peripheral devices, or a clock, the
operating system manages communications between all the
processes. Multiple processes communicate with one another
through communication lines in the network.
• The OS handles routing and connection strategies, and the
problems of contention and security. Following are the major
activities of an operating system with respect to communication −
• Two processes often require data to be transferred between them
• Both the processes can be on one computer or on different
computers, but are connected through a computer network.
• Communication may be implemented by two methods, either by
Shared Memory or by Message Passing.
Error handling
• Errors can occur anytime and anywhere. An error may occur in CPU,
in I/O devices or in the memory hardware. Following are the major
activities of an operating system with respect to error handling −
• The OS constantly checks for possible errors.
• The OS takes an appropriate action to ensure correct and consistent
computing.
Resource Management
• In case of multi-user or multi-tasking environment, resources such
as main memory, CPU cycles and files storage are to be allocated to
each user or job. Following are the major activities of an operating
system with respect to resource management −
• The OS manages all kinds of resources using schedulers.
• CPU scheduling algorithms are used for better utilization of CPU.
Protection
• Considering a computer system having multiple users and
concurrent execution of multiple processes, the various
processes must be protected from each other's activities.
• Protection refers to a mechanism or a way to control the
access of programs, processes, or users to the resources
defined by a computer system. Following are the major
activities of an operating system with respect to protection
−
• The OS ensures that all access to system resources is
controlled.
• The OS ensures that external I/O devices are protected
from invalid access attempts.
• The OS provides authentication features for each user by
means of passwords.
CreateProcess() fork()
Process Control ExitProcess() exit()
WaitForSingleObject() wait()
CreateFile() open()
ReadFile() read()
File Management
WriteFile() write()
CloseHandle() close()
SetConsoleMode() ioctl()
Device Management ReadConsole() read()
WriteConsole() write()
GetCurrentProcessID() getpid()
Information Maintenance SetTimer() alarm()
Sleep() sleep()
CreatePipe() pipe()
Communication CreateFileMapping() shmget()
MapViewOfFile() mmap()