0% found this document useful (0 votes)
14 views18 pages

OPerating System Unit 1

The document provides an overview of operating systems, detailing various types such as batch, multitasking, distributed, real-time, multiprogramming, multiprocessing, network, and mobile operating systems, along with their advantages and disadvantages. It also discusses key operating system concepts including processes, address spaces, files, input/output management, protection, and user interfaces, as well as the services provided by operating systems. Additionally, the document explains system calls and their role in interfacing with operating system services.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views18 pages

OPerating System Unit 1

The document provides an overview of operating systems, detailing various types such as batch, multitasking, distributed, real-time, multiprogramming, multiprocessing, network, and mobile operating systems, along with their advantages and disadvantages. It also discusses key operating system concepts including processes, address spaces, files, input/output management, protection, and user interfaces, as well as the services provided by operating systems. Additionally, the document explains system calls and their role in interfacing with operating system services.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

II BSC (Semester IV) Operating Systems

UNIT - I
Introduction to Operating System Concept:
Types of operating Systems
Operating Systems concepts
Operating systems Services
Introduction to System call
System calls types.

Department of Computer Science, TJPS College, Guntur. 1


Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems
1. Explain about Types of operating systems?
1. Batch Operating System: This type of operating system does not interact with the computer
directly. There is an operator which takes similar jobs having the same requirement and group
them into batches. It is the responsibility of the operator to sort jobs with similar needs.

Advantages: The multiple users can share the batch systems and idle time is very less.
Disadvantages: It is costly and difficult to debug.
2. Multi-Tasking/Time-sharing Operating Systems: Each task is given some time to execute
so that all the tasks work smoothly. Each user gets the time of CPU as they use a single system.
These systems are also known as Multitasking Systems. The task can be from a single user or
different users also. The time that each task gets to execute is called quantum. After this time
interval is over OS switches over to the next task.

Advantages: Each task gets an equal opportunity and CPU idle time can be reduced.
Disadvantages: Reliability and data communication problem.
3.Distributed Operating System: It use multiple central processors to serve multiple real-time
applications and multiple users. Data processing jobs are distributed among the processors. The
processors communicate with one another through various communication lines .These are
referred as loosely coupled systems or distributed Operating systems.
Advantages: It provides sharing of resources and fault-tolerant.
Disadvantages: It can dominate computation cost.

Department of Computer Science, TJPS College, Guntur. 2


Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems

4. Real-Time Operating System: The time interval required to process and respond to inputs is
very small. This time interval is called response time. Real-time Operating systems are used
when there are time requirements that are very strict like missile systems, air traffic control
systems, robots, etc. There are two types
(A).Hard Real-Time Systems: These OSs is meant for applications where time constraints
are very strict and even the shortest possible delay is not acceptable. These systems are built
for saving life like automatic parachutes or airbags which are required to be readily available in
case of any accident. Virtual memory is rarely found in these systems.
(B).Soft Real-Time Systems: These OSs is for applications where for time-constraint is less
strict.

Advantages: Easy to layout, develop and execute real-time applications and maximum
utilization of devices and systems.
Disadvantages: These are very costly to develop and complex, consume critical CPU cycles.
5.Multi-Programming Operating System: Multiprogramming is an extension to batch
processing where the CPU is always kept busy. Each process needs two types of system time:
CPU time and IO time. In a multiprogramming environment, when a process does its I/O, The
CPU can start the execution of other processes. Therefore, multiprogramming improves the
efficiency of the system.
Advantages: Response time can also be reduced.

Department of Computer Science, TJPS College, Guntur. 3


Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems
Disadvantages: They do not provide any user interaction with the computer system.

6. Multiprocessing Operating System: There are more than one processors present in the
system which can execute more than one process at the same time. This will increase the
throughput of the system.

Advantages: This increases reliability and more work can be done in less.
Disadvantages: It is more complex.
7. Network Operating System: Network Operating System runs on a server. It provides the
capability to serve to manage data, user, groups, security, application, and other networking
functions.

Department of Computer Science, TJPS College, Guntur. 4


Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems

Advantages: The network traffic reduces and less expensive.


Disadvantages: The failure of any node in a system affects the whole system and Security and
performance issues.
8. Mobile Operating Systems: Mobile operating systems are those OS which is especially that
are designed to power smartphones, tablets, and wearables devices.
Some most famous mobile operating systems are Android and iOS, but others include
BlackBerry, Web, and watchOS.

------------------------------------XXXXXXXXXXXXXXX-------------------------------------------
2. Explain the operating System Concepts.
1. Processes: A process is basically a program in execution. Associated with each process is its
address space, a list of memory locations from 0 to some maximum, which the process can read
and write. The address space contains the executable program, the program’s data, and its stack.
Also associated with each process is a set of resources, commonly including registers (including
the program counter and stack pointer), a list of open files, outstanding alarms, lists of related
processes, and all the other information needed to run the program. In many operating systems,
all the information about each process, other than the contents of its own address space, is stored
in an operating system table called the process table.

Department of Computer Science, TJPS College, Guntur. 5


Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems
2. Address Spaces: Every computer has some main memory that it uses to hold executing
programs. In a very simple operating system, only one program at a time is in memory. To run a
second program, the first one has to be removed and the second one placed in memory. The
operating systems allow multiple programs to be in memory at the same time. To keep them
from interfering with one another, some kind of protection mechanism is needed. The computers
addresses are 32 or 64 bits, giving an address space of 232 or 264 bytes, respectively.
3. Files: The system calls are obviously needed to create files, remove files, read files, and write
files. Before a file can be read, it must be located on the disk and opened, and after being read it
should be closed. The operating systems have the concept of a directory as a way of grouping
files together.

4. Input/output: Every operating system has an I/O subsystem for managing its I/O devices.
Some of the I/O software is device independent, that is, applies to many or all I/O devices
equally well.
5. Protection: Computers contain large amounts of information that users often want to protect
and keep confidential. This information may include email, business plans, tax returns, and much
more. Files in UNIX are protected by assigning each one a 9-bit binary protection code. The
protection code consists of three 3-bit fields, one for the owner, one for other members of the
owner’s group and one for everyone else. Each field has a bit for read access, a bit for write
access, and a bit for execute access. These 3 bits are known as the rwx bits.
6. The Shell: The user is using a graphical user interface. Many shells exist, including sh, csh,
ksh, and bash. All of them support the functionality described below, which derives from the
original shell (sh). When any user logs in, a shell is started up. The shell has the terminal as
Department of Computer Science, TJPS College, Guntur. 6
Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems
standard input and standard output. It starts out by typing the prompt, a character such as a
dollar sign, which tells the user that the shell is waiting to accept a command. For Example
date >file
7. Ontogeny Recapitulates Phylogeny:
A) Large Memories : The first mainframes had limited memory. A fully loaded IBM 7090 or 7094,
which played king of the mountain from late 1959 until 1964, had just over 128 KB of memory. The first
commercial minicomputer (the PDP-1) was released, it had only 4096 18-bit words of memory, and
assembly language made a surprise comeback. When microcomputers hit in the early 1980s, the first ones
had 4-KB memories and assembly-language programming rose from the dead. Embedded computers
often used the same CPU chips as the microcomputers (8080s, Z80s, and later 8086s) and were also
programmed in assembler initially.
B) Protection Hardware: The introduction of the IBM 360, a primitive form of hardware protection
became available. These machines could then hold several programs in memory at the same time and let
them take turns running (multiprogramming). When the first microcomputers were built, they used the
Intel 8080 CPU chip, which had no hardware protection, so we were back to monoprogramming one
program in memory at a time. It was not until the Intel 80286 chip that protection hardware was added
and multiprogramming became possible.
C) Disks: IBM introduced the first hard disk—the RAMAC (RAndoM ACcess) in 1956. Users
could create so-called ‘‘permanent files’’ by giving them names and hoping that no other user
had also decided that, say, ‘‘data’’ was a suitable name for a file. This was a single-level
directory. Eventually, mainframes developed complex hierarchical file systems, perhaps
culminating in the MULTICS file system.
D) Virtual Memory: Virtual memory also allowed having a program dynamically link in a
library at run time instead of having it compiled in. MULTICS was the first system to allow this.
--------------------------------------XXXXXXXXXXXXX------------------------------------------------
3. What are the operating systems services?
An operating system provides an environment for the execution of programs. It provides
certain services to programs and to the users of those programs. The services are provided for the
convenience of the programmer, to make the programming task easier.

Department of Computer Science, TJPS College, Guntur. 7


Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems

1. User Interface (UI):


➢ Command-line Interface (CLI): It uses text commands and a method for entering them.
➢ Batch Interface: The commands and directives to control those commands are entered
into files, and those files are executed
➢ Graphical User Interface (GUI): 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.
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.
3. I/O Operations: A running program may require I/O, which may involve a file or an I/O
device. For specific devices, special functions may be desired. For efficiency and protection,
users usually cannot control I/O devices directly.
4. File-System Manipulation: The 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.
Finally, some operating systems include permissions management to allow or deny access to
files or directories based on file ownership.
5. Communications: one process needs to exchange information with another process. Such
communication may occur between processes that are executing on the same computer or
between processes that are executing on different computer systems. Communications may be

Department of Computer Science, TJPS College, Guntur. 8


Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems
implemented via Shared Memory, in which two or more processes read and write to a shared
section of memory, or Message Passing, in which packets of information in predefined formats
are moved between processes by the operating system.
6. Error detection: The operating system needs to be detecting and correcting errors constantly.
Errors may occur in the CPU and memory hardware, 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.
7. Resource allocation: There are multiple users or multiple jobs running at the same time,
resources must be allocated to each of them. The operating system manages many different types
of resources. Operating systems have CPU-scheduling routines that take into account the speed
of the CPU, the jobs that must be executed, the number of registers available, and other factors.
There may also be routines to allocate printers, 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. Usage statistics may be a valuable tool for researchers who wish to reconfigure the
system to improve computing services.
9. Protection and security: Protection involves ensuring that all access to system resources is
controlled. Security of the system from outsiders is also important. 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.
--------------------------------------XXXXXXXXXXXXX------------------------------------------------
4. Explain the System call.
It provides an interface to the services made available by an operating system. These calls
are generally available as routines written in C and C++, although certain low-level tasks may
have to be written using assembly-language instructions.

First use an example to illustrate how system calls are used: writing a simple program to
read data from one file and copy them to another file. The first input that the program will need
is the names of the two files: the input file and the output file.

One approach is for the program to ask the user for the names. In an interactive system,
this approach will require a sequence of system calls, first to write a prompting message on the
screen and then to read from the keyboard the characters that define the two files. On mouse-
based and icon-based systems, a menu of file names is usually displayed in a window.

Department of Computer Science, TJPS College, Guntur. 9


Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems
The user can then use the mouse to select the source name, and a window can be opened
for the destination name to be specified. This sequence requires many I/O system calls. Once the
two file names have been obtained, the program must open the input file and create the output
file. Each of these operations requires another system call. Possible error conditions for each
operation can require additional system calls. When the program tries to open the input file, for
example, it may find that there is no file of that name or that the file is protected against access.

The program should print a message on the console and then terminate abnormally.
If the input file exists, then we must create a new output file. There is already an output file with
the same name. This situation may cause the program to abort, or we may delete the existing file
and create a new one.

The write operation may encounter various errors, depending on the output device.
Finally, after the entire file is copied, the program may close both files; write a message to the
console or window, and finally terminate normally.

The API specifies a set of functions that are available to an application programmer,
including the parameters that are passed to each function and the return values the programmer
can expect. Three of the most common APIs available to application programmers are the
Windows API for Windows systems, the POSIX API for POSIX-based systems and the Java API
for programs that run on the Java virtual machine.

Department of Computer Science, TJPS College, Guntur. 10


Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems
A programmer accesses an API via a library of code provided by the operating system. In
the case of UNIX and Linux for programs written in the C language, the library is called libc.
For example, the Windows function CreateProcess( ) actually invokes the NTCreateProcess( )
system call in the Windows kernel.

An application programmer designing a program using an API can expect her program
to compile and run on any system that supports the same API. A strong correlation between a
function in the API and its associated system call within the kernel.

The run-time support system provides a System Call Interface that serves as the link to
system calls made available by the operating system. A number is associated with each system
call, and the system-call interface maintains a table indexed according to these numbers. The
system call interface then invokes the intended system call in the operating-system kernel and
returns the status of the system call and any return values. The relationship between an API, the

Department of Computer Science, TJPS College, Guntur. 11


Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems
system-call interface and the operating system is shown, which illustrates how the operating
system handles a user application invoking the open() system call.

Three general methods are used to pass parameters to the operating system.
1. The simplest approach is to pass the parameters in registers.
2. The parameters are generally stored in a block, or table, in memory, and the address of the
block is passed as a parameter in a register. This is the approach taken by Linux and Solaris.
3. Parameters also can be placed or pushed, onto the stack by the program and popped off the
stack by the operating system.

Some operating systems prefer the block or stack method because those approaches do
not limit the number or length of parameters being passed.

------------------------------XXXXXXXXXXXXXXX---------------------------------------------------

Department of Computer Science, TJPS College, Guntur. 12


Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems
5. Explain the System call types.
There are six types of System calls.

Department of Computer Science, TJPS College, Guntur. 13


Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems

1. Process Control: 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, or if the program runs into a problem and causes an error trap, a dump of
memory is sometimes taken and an error Message generated. The dump is written to disk and
may be examined by a debugger—a system program designed to aid the programmer in finding
and correcting errors, or bugs—to determine the cause of the problem.

Under either normal or abnormal circumstances, the operating system must transfer
control to the invoking command interpreter. The command interpreter then reads the next
command. In an interactive system, the command interpreter simply continues with the next
command; it is assumed that the user will issue an appropriate command to respond to any error.

In a GUI system, a pop-up window might alert the user to the error and ask for guidance.
In a batch system, the command interpreter usually terminates the entire job and continues with
the next job.

Department of Computer Science, TJPS College, Guntur. 14


Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems
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, for
example, a user command, the click of a mouse, or a batch command. The question is related to
whether the existing program is lost, saved, or allowed to continue execution concurrently with
the new program.

If control returns to the existing program when the new program terminates, we must
save the memory image of the existing program; thus, we have effectively created a mechanism
for one program to call another program. If both programs continue concurrently, we have
created a new job or process to be multiprogrammed (create process() or submit job()).

The MS-DOS operating system is an example of a single-tasking system. It has a


command interpreter that is invoked when the computer is started. Because MS-DOS is single-
tasking, it uses a simple method to run a program and does not create a new process. It loads the
program into memory, writing over most of itself to give the program as much memory as

Department of Computer Science, TJPS College, Guntur. 15


Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems
possible. Next, it sets the instruction pointer to the first instruction of the program. The program
then runs, and either an error causes a trap, or the program executes a system call to terminate.

MS-DOS execution. (a) At system startup. (b) Running a program.


FreeBSD (derived from Berkeley UNIX) is an example of a multitasking system. When a user
logs on to the system, the shell of the user’s choice is run. This shell is similar to the MS-DOS
shell in that it accepts commands and executes programs that the user requests. However, since
FreeBSD is a multitasking system, the command interpreter may continue running while another
program is executed. To start a new process, the shell executes a fork() system call. Then, the
selected program is loaded into memory via an exec() system call, and the program is executed.
Depending on the way the command was issued, the shell then either waits for the process to
finish or runs the process “in the background”. When the process is done, it executes an exit()
system call to terminate.

FreeBSD running multiple programs


Department of Computer Science, TJPS College, Guntur. 16
Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems
2. File Management:
We first need to be able to create( ) and delete( ) files. Either system call requires the name
of the file and perhaps some of the file’s attributes. Once the file is created, we need to open( ) it
and to use it. We may also read( ), write( ), or reposition( ). Finally, we need to close( ) the file.
we have a directory structure for organizing files in the file system. In addition, for either files or
directories, we need to be able to determine the values of various attributes and perhaps to reset
them if necessary. File attributes include the file name, file type, protection codes, accounting
information, and so on. At least two system calls, get file attributes( ) and set file attributes( ), are
required for this function.
3. Device Management:
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 controlled by the operating system can be thought of as devices. Some of
these devices are physical devices, while others can be thought of as abstract or virtual devices.
A system with multiple users may require us to first request( ) a device, to ensure exclusive use
of it. After we are finished with the device, we release( ) it. These functions are similar to the
open( ) and close( ) system calls for files.
4. Information Maintenance:
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(). A program trace lists each system call as it is executed. Even
microprocessors provide a CPU mode known as single step, in which a trap is executed by the
CPU after every instruction. The trap is usually caught by a debugger.
A time profile requires either a tracing facility or regular timer interrupts. At every
occurrence of the timer interrupt, the value of the program counter is recorded. 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.
5. Communication:
There are two common models of interprocess communication: the message passing model
and the shared-memory model.
A) 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

Department of Computer Science, TJPS College, Guntur. 17


Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems
through a common mailbox. 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 hostid( ) and get processid( ) system calls do this
translation.
The identifiers are then passed to the general purpose open() and close() calls
provided by the file system or to specific open connection() and close connection() system calls,
depending on the system’s model of communication. The source of the communication, known
as the client, and the receiving daemon, known as a server.
B) 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. Shared memory requires
that two or more processes agree to remove this restriction. They can then exchange information
by reading and writing data in the shared areas. The processes are also responsible for ensuring
that they are not writing to the same location simultaneously.
6. Protection:
It provides a mechanism for controlling access to the resources provided by a computer
system. Protection was a concern only on multiprogrammed computer systems with several
users. System calls providing protection include set permission() and get permission(), which
manipulate the permission settings of resources such as files and disks. The allow user() and
deny user() system calls specify whether particular users can or cannot be allowed access to
certain resources.
--------------------------------------XXXXXXXXXXXXXXX--------------------------------------------

Department of Computer Science, TJPS College, Guntur. 18


Prepared by KADIRI NAGESWARA RAO. MCA

You might also like