Osy Unit 1
Osy Unit 1
1
Operating System 315319
1. Process Management
- A process is a program in execution.
- The OS is responsible for: Creating and deleting processes, Scheduling
processes (deciding which one runs when), Multitasking (running multiple
processes at once), Handling synchronization and inter-process
communication (IPC).
- Example: While browsing the internet, your antivirus, music player, and
system updates may all be running simultaneously. The OS manages all
these processes efficiently.
2. Memory Management
- Controls how RAM is used and shared.
- Key responsibilities: Allocating and deallocating memory to programs,
Managing virtual memory (using disk space as extra RAM),Memory
protection between different applications.
- Example: When you open Photoshop and a browser, each gets its own
memory block managed by the OS.
2
Operating System 315319
4. Device Management
- Controls all input/output (I/O) devices like keyboard, mouse, printer, USB
drives.
- Uses device drivers to communicate with hardware, Manages I/O
operations through: Buffering (temporary storage), Spooling (managing
print jobs), Interrupt handling.
- Example: When you print a document, the OS sends data to the printer
while letting you continue working.
7. Resource Management
- Manages hardware resources like CPU, memory, storage, and I/O devices.
- Allocates resources efficiently among different users and tasks.
- Prevents resource conflicts and ensures fair usage.
- Example: If two apps need the printer, the OS queues the requests
properly.
8. Networking
- Manages network connections and data transfer.
- Supports communication between devices using protocols like TCP/IP.
- Enables file sharing, internet access, and remote login.
- Example: Downloading a file from the internet or connecting to a Wi-Fi
network.
3
Operating System 315319
- The programmers would leave their programs with the operator. To speed
up the processing, the operator would sort programs into batches with
similar requirements and, as the computer became available, he will run
each batch. The output from each job would be sent back to the
appropriate programmer.
- In this execution environment, the CPU is often idle, because the speeds of
the mechanical I/O devices are slower than those of electronic devices.
The improvements in technology introduces a disks resulted in faster I/O
devices.
CPU speeds increased to an even greater extent. The introduction of disk
technology allowed the operating system to keep all jobs on a disk, rather
4
Operating System 315319
than in a serial card reader. The operating system could perform job
scheduling, to use resources and perform tasks efficiently.
Advantages :
1. Efficient Use of Resources
2. Reduced Setup Time
3. Good for Repetitive Tasks
4. Simple Job Scheduling
Disadvantages :
1. CPU Utilization is less
2. I/O is slower than CPU, so CPU sits idle
3. Memory utilization is less
4. Difficult to debug program
5
Operating System 315319
Multiprogramming has no guarantee that a program will run in a timely manner. Usually on a
mainframe – the computer has a number of programs loaded into memory and the operating
system switches quickly between them, processing a little bit of each one in turn. The high
speed of the processor makes it seem like more than one program is being run at the same
time. On a PC it is usually called multitasking. If the machine has the capability of causing an
interrupt after a specified time interval, then the operating system will execute each program
for a given length of time, regain control, and then execute another program for a given
length of time, and so on. In the absence of this mechanism, the operating system has no
choice but to begin to execute a program with the expectation, but not the certainty, that the
program will eventually return control to the operating system. If the machine has the
capability of protecting memory, then a bug in one program is less likely to interfere with the
execution of other programs. In a system without memory protection, one program can
change the contents of storage assigned to other programs or even the storage assigned to the
operating system. The resulting system crashes are not only disruptive, they may be very
difficult to debug since it may not be obvious which of several programs is at fault. If
memory can hold several programs, then CPU can switch to another one whenever a program
is awaiting for an I/O to complete.
Multiple jobs are executed by the CPU by switching between them, but the switches occur so
frequently. Thus, the user can receive an immediate response. For example, in a transaction
processing, the processor executes each user program in a short burst or quantum of
computation. That is, if n users are present, then each user can get a time quantum. When the
user submits the command, the response time is in few seconds at most.
6
Operating System 315319
A time-shared operating system uses CPU scheduling and multiprogramming to provide each
user with a small portion of a time. Time-sharing operating systems are even more complex
than multiprogrammed operating systems.
Advantages
1. Provides the advantage of quick response.
2. Avoids duplication of software.
3. Reduces CPU idle time.
Disadvantages
1. Problem of reliability.
2. Question of security and integrity of user programs and data.
3. Problem of data communication.
7
Operating System 315319
In which each processor is assigned a specific task. This scheme defines a master-slave
relationship. A master processor controls the system; the other processors either look to the
master for instruction or have predefined tasks.
Advantages:
1. Less time duration required for the large process.
2. Increase throughput. i.e. more work done in less time.
3. Economy of scale.
4. Increased reliability.
Disadvantages:
1. If one processor fails then it will affect in speed.
2. These systems are expensive.
2.1.1 Distributed System
A distributed system consists of multiple autonomous computers that communicate through a
computer networks. The word distributed referred to computer networks where individual
computers were physically distributed within some geographical area. It is a collection of
processors that do not share memory. Each processor has its own memory and processor
communicate with each other through communication lines like LAN, WAN etc. A
distributed system may have a common goal, such as solving a large computational problem.
In distributed computing, a problem is divided into many tasks, each of which is solved by
one computer. In this system, each computer may have its own user with individual needs.
The purpose of the distributed system is to coordinate the use of shared resources or provide
communication services to the users.
Following are the four major reasons for building a distributed system: Resource Sharing,
computation speed up, Reliability and communication.
Advantages
1. With resource sharing facility, a user at one site may be able to use the
resources available at another.
2. Speedup the exchange of data with one another via electronic mail.
3. If one site fails in a distributed system, the remaining sites can
potentially continue operating.
4. Better service to the customers.
5. Reduction of the load on the host computer.
6. Reduction of delays in data processing.
Disadvantages
1. Complexity
2. Increased Network Traffic
3. Security Risks
4. Lack of Centralized Control
Applications:
1. Flight Control System
2. Simulations
3. Industrial control
4. Military applications
2.1.3 Mobile OS (Android OS)
- Android is a mobile operating system developed by Google. It is based on
a modified version of the Linux kernel and other open source software,
and is designed primarily for touchscreen mobile devices such as
smartphones and tablets. In addition, Google has developed Android TV
for televisions, Android Auto for cars, and Wear OS for wrist watches,
each with a specialized user interface. Variants of Android are also used
on game consoles, digital cameras, PCs and other electronics.
- The Android OS was originally created by Android, Inc., which was
bought by Google in 2005. Each time the OHA releases an Android
version, it names the release after a dessert. Android 1.5 is known as
Cupcake, 1.6 as Donut, 2.0/2.1 as Eclair, 2.2 as Froyo and 2.3 is dubbed
Gingerbread. Once a version is released, so is its source code.
- The Android OS is designed for phones. Its many features include:
• Integrated browser, based on the open source WebKit engine
• Optimized 2D and 3D graphics, multimedia and GSM connectivity
• Bluetooth • EDGE • 3G
• WiFi • SQLite • Camera
• GPS • Compass • Accelerometer
- Software developers who want to create applications for the Android OS
can download the Android Software Development Kit (SDK) for a specific
version. The SDK includes a debugger, libraries, an emulator, some
documentation, sample code and tutorials. For faster development,
interested parties can use graphical integrated development environments
(IDEs) such as Eclipse to write applications in Java. In the 4th quarter of
2010, smart phones running Android OS garnered the top spot for most
shipments. The Android OS can be found in phones from different
manufacturers, including the Samsung Nexus S, HTC Evo Shift 4G and
Motorola Atrix 4G. A couple of new mobile OSs are now based on
Android, including Open Mobile System (OMS) and Tapas.
10
Operating System 315319
11
Operating System 315319
system services are provided for the convenience of the programmer, to make the
programming task easier.
Operating system services provides functions that are helpful for user as well as they
ensure the efficient operation of the system itself.
For User:
1. User interface. Almost all operating systems have a user interface (UI). This interface
can take several forms. One is a command-line interface (CLI), which uses text
commands and a method for entering them. Another is a batch interface, in which
commands and directives to control those commands are entered into files, and those
files are executed. Most commonly, a graphical user interface (GUI) is used. Here, the
interface is a window system with a pointing device to direct I/O, choose from menus,
and make selections and a keyboard to enter text. Some systems provide two or all three
of these variations.
2. Program execution. The system must be able to load a program into memory and to run
that program. The program must be able to end its execution, either normally or
abnormally (indicating error).
3. I/O operations. A running program may require I/O, which may involve a file or an I/O
device. For efficiency and protection, users usually cannot control I/O devices directly.
Therefore, the operating system must provide a means to do I/O.
4. File-system manipulation. Programs need to read and write files and directories. They
also need to create and delete them by name, search for a given file, and list file
information. Some programs include permissions management to allow or deny access
to files or directories based on file ownership. Programs may need to read and write data
from and to the files and directories. Operating system manages the secondary storage.
User gives a command for reading or writing to a file. Operating system makes it easier
for user programs to accomplish their task such as opening a file, saving a file and
deleting a file from the storage disk. It also provides services for file permission
management to allow or deny access to files or directories based on file ownership.
5. Communications Many time, one process needs to exchange information with another
process. Such communication may occur between processes that are executing on the
same computer or different computer systems tied together by a computer network.
Communications may be implemented via shared memory or message passing, in which
packets of information are moved between processes by the operating system.
6. Error detection. The operating system needs to be constantly aware of possible errors.
Errors may occur in the CPU and memory hardware (such as a memory error or a power
failure), in I/O devices and in the user program. For each type of error, the operating
system should take the appropriate action to ensure correct and consistent computing.
Debugging facilities can enhance the user's and programmer's abilities to use the system
efficiently.
12
Operating System 315319
operating systems have CPU-scheduling routines. There may also be routines to allocate
printers, modems, USB storage drives, and other peripheral devices.
8. Accounting. We want to keep track of which users use how much and what kinds of
computer resources. This record keeping may be used for accounting or simply for
accumulating usage statistics.
9. Protection and security.
Protection involves ensuring that all access to system resources is controlled. Security of
the system from outsiders is also important. Such security starts with requiring each user
to authenticate himself or herself to the system, usually by means of a password, to gain
access to system resources.
1. Process Control
end, abort
load, execute
create process, terminate process
get process attributes, set process attributes
wait for time
wait event, signal event
allocate and free memory
- A running program needs to be able to halt its execution either normally (end) or
abnormally (abort). If a system call is made to terminate the currently running program
abnormally, a dump of memory is taken and an error message generated. The dump is
written to disk and may be examined by a debugger, to determine the cause of the error.
13
Operating System 315319
Under either normal or abnormal circumstances, the operating system must transfer
control to the command interpreter. The command interpreter then reads the next
command.
- A process or job executing one program may want to load and execute another program.
This feature allows the command interpreter to execute a program as directed by, a user
thus, we have effectively created a mechanism for one program to call another program.
If both programs execute concurrently, we have created a new job or process to be
multiprogrammed. For this purpose, a system call exist like create process or submit job.
- If we create a new job or process, we should be able to control its execution. This control
requires the ability to determine and reset the attributes of a job or process, including the
job's priority, its maximum allowable execution time, and so on. For this purpose, the
system call get process attributes and set process attributes is used. If we want to
terminate a job or process that we created, use terminate process system call.
- After creating new jobs or processes, we may need to wait for them to finish their
execution. We may want to wait for a certain amount of time, use wait time system call;
If we want to wait for a specific event to occur, use wait event system call. The jobs or
processes should then signal when that event has occurred, use signal event system call.
2. File Management
create file, delete file
open, close
read, write, reposition
get file attributes, set file attributes
- The following system calls are common when dealing with files. We first need system
calls, to create and delete files. System call requires the name of the file and its
attributes. Once the file is created, we need to open it and to use it. We may also read,
write, or reposition i.e. rewrite or skip to the end of the file. Finally, we need to close the
file.
- We may need these same sets of operations for directories. In addition, for r files or
directories, we need to be able to determine the various attributes and to reset them if
necessary. File attributes include the file name, a file type, protection codes, accounting
information, and so on. For this function, the system calls are get file attribute and set
file attribute.
3. Device Management
request device, release device
read, write, reposition
get device attributes, set device attributes
logically attach or detach devices
14
Operating System 315319
- A process may need several resources to execute—main memory, disk drives, access to
files, and so on. If the resources are available, they can be granted, and control can be
returned to the user process. Otherwise, the process will have to wait until sufficient
resources are available.
- The various resources i.e. devices controlled by the operating system. Some of these
devices are physical devices (for example, tapes), or virtual devices (for example, files).
If there are multiple users of the system, the system may first request the device to use.
After we are finished with the device, we release it. Once the device has been requested,
we can read, write, and reposition the device.
4. Information Maintenance:
get time or date, set time or date
get system data, set system
data set process, file, or device attributes
set process, file, or device attributes
- Many system calls exist simply for the purpose of transferring information between the
user program and the operating system. For example, most systems have a system call to
return the current time and date. Other system calls may return information about the
system, such as the number of current users, the version number of the operating system,
the amount of free memory or disk space, and so on.
- In addition, the operating system keeps information about all its processes, and system
calls are used to access this information. Generally, calls are also used to reset the
process information (get process attributes and set process attributes).
5. Communication
create, delete communication connection
send, receive messages
transfer status information
attach or detach remote devices
- There are two common models of interprocess communication: the message-passing
model and the shared-memory model.
- In the message-passing model, the communicating processes exchange messages with
one another to transfer information. Messages can be exchanged between the processes
either directly or indirectly through a common mailbox. Before communication can take
place, a connection must be established. Each computer in a network has a host name by
which it is commonly known. A host also has a network identifier, such as an IP address.
Similarly, each process has a process name, and this name is translated into an identifier
by which the operating system can refer to the process. The get host id and get processID
system calls do this translation. These identifiers are then passed to the specific open
connection and close connection system calls. The recipient process must give its
permission for communication with an accept connection system call. Most processes
that will be receiving connections execute a wait for connection system call. Messages
15
Operating System 315319
are exchanges between sources and receiving machines by using read message and write
message system calls. The close connection call terminates the communication.
- In the shared-memory model, processes use shared memory create and shared memory
attach system calls to create and gain access to regions of memory owned by other
processes. They can then exchange information by reading and writing data in the shared
areas. The form of the data and the location are determined by the processes and are not
under the operating system's control. The processes are also responsible for ensuring that
they are not writing to the same location simultaneously. Message passing is useful when
smaller amounts of data need to be exchanged because conflicts needs be avoided. It is
easy to implement than shared memory for inter computer communication. Shared
memory allows maximum speed and convenience of communication.
16
Operating System 315319
3. File Management:
It is one of the most visible components of operating system. Computers can store
information on several different types of physical media, such as magnetic tape,
magnetic disk, optical disk etc. Each of these media has its own characteristics and
physical organization. Each media is controlled by a device such as a disk drive and
tape drive. They also have unique characteristics. These properties include access
speed, capacity, data transfer rate, and access method i.e. sequential or random. For
efficient and convenient use of computer system, the operating system provides a
uniform logical view of information storage. The operating system maps files onto
physical media and access these files via the storage devices. A file is a collection of
related information defined by its creator. Generally, file represents programs and data,
Data files may be alphabetic, numeric or alphanumeric. The operating system
implements the abstract concept of file by managing mass storage media. Files are
normally organized into directories for easy use. The operating system is responsible
for the following activities:
4. I/O management:
Operating system hides the peculiarities (odd behaviour) of specific hardware devices
from the user. In UNIX, the peculiarities of I/O devices are hidden from the bulk of the
operating system itself by the I/O subsystem. The I/O subsystem consist of
A memory management component that includes buffering, caching and
spooling
A general device driver interface
Drivers for specific hardware device
I/O System: Input / Output device management provides an environment for the
better interaction between system and the I / O devices such as printers, scanners, tape
drives etc. To interact with I/O devices in an effective manner, the operating system
use some special programs known as device driver. The device drivers take the data
that operating system has defined as a file and then translate them into streams of bits
or a series o laser. A device driver is a specific type of computer software that is
developed to allow interaction with hardware devices. Typically this continues an
interface for communicating with the I/O device, through the specific computer bus or
communication subsystem that the hardware is connected with. The device driver is a
specialized hardware dependent computer program that enables another program,
typically an operating system to interact transparently with a hardware device, and
17
Operating System 315319
usually provides the required interrupt handling necessary for the time dependent
hardware interfacing.
Providing interfaces to other system components.
Managing devices
Transferring data
Detecting I/O completion
(spooling refers to a process of transferring data by placing it into a temporary
working area where another program may access it for processing by later time.) Only the
device drivers know the peculiarities of the specific device to which it is assigned.
18