0% found this document useful (0 votes)
35 views17 pages

Operating System Introduction

This document provides an overview of operating system concepts including processes, files, shells, system calls, and operating system structures. It discusses different views of the operating system as an extended machine that hides hardware complexity, and as a resource manager that controls allocation of processors, memory, and I/O devices. Key components of operating systems are described such as the kernel, files, directories, shells, and system calls. Operating system evolution is also briefly outlined.

Uploaded by

Hy People
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)
35 views17 pages

Operating System Introduction

This document provides an overview of operating system concepts including processes, files, shells, system calls, and operating system structures. It discusses different views of the operating system as an extended machine that hides hardware complexity, and as a resource manager that controls allocation of processors, memory, and I/O devices. Key components of operating systems are described such as the kernel, files, directories, shells, and system calls. Operating system evolution is also briefly outlined.

Uploaded by

Hy People
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/ 17

Chapter 1: Principle of Operating System

Introduction, Operations System Concepts: Processes, files, shell, system calls, security and Operating
System structure: Monolithic systems, Layered, Virtual Machines, Client – Server and Evolution of
Operating Systems: User driven, operator driven, simple batch system, off – line batch system, directly
coupled off – line system, multi- programmed spooling system, on-line timesharing system,
multiprocessor systems, multi-computer/ distributed systems, Real time Operating Systems

Operating System Introduction:


Computer Software can roughly be divided into two types:
a). Application Software: Which perform the actual work the user wants.
b). System Software: Which manage the operation of the computer itself.
The most fundamental system program is the operating system, whose job is to control all the
computer's resources and provide a base upon which the application program can be written. Operating
system acts as an intermediary between a user of a computer and the computer hardware.

Fig 1.1 Abstract view of the components of a Computer System.

A computer system can be divided roughly into four components: the hardware, the operating system,
the application program, and the users as shown in the fig 1.1

Page:5
An operating system is similar to a government. Like a government it performs no useful function by
itself. It simply provides an environment within which other programs can do useful work.

Two views of the Operating System:

Operating System as an Extended Machine or Virtual Machine(or As a User/computer


interface)
The operating system masks or hides the details of the Hardware form the programmers and general
users and provides a convenient interface for using the system. The program that hides the truth about
the hardware from the user and presents a nice simple view of named files that can be read and written
is of course the operating system. In this view the function of OS is to present the user with the
equivalent of an extended machine or virtual machine that is easier to program than underlying
hardware. Just as the operating system shields the user from the disk hardware and presents a simple
file-oriented interface, it also conceals a lot of unpleasant business concerning interrupts,
timers,memory management and other low level features.
The placement of OS is as shown in fig1.2 A major function of OS is to hide all the complexity
presented by the underlying hardware and gives the programmer a more convenient set of instructions
to work with.

Fig1.2: Computer system consists of Hardware, system program and


application program

Operating System as a Resource Manager


A computer system has many resources. Modern computers consist of processors, memories, timers,
disks, mice, network interfaces, printers, and a wide variety of other devices. In the alternative view,
the job of the operating system is to provide for an orderly and controlled allocation of the processors,
memories, and I/O devices among the various programs competing for them.
Imagine what would happen if three programs running on some computer all tried to print their output
simultaneously on the same printer. The first few lines of printout might be from program 1, the next

Page:6
few from program 2, then some from program 3, and so forth. The result would be chaos. The
operating system can bring order to the potential chaos by buffering all the output destined for the
printer on the disk. When one program is finished, the operating system can then copy its output from
the disk file where it has been stored to the printer, while at the same time the other program can
continue generating more output, oblivious to the fact that the output is not really going to the printer
(yet).

Figure 1.3 suggests the main resources that are managed by the OS. A portion of the OS is in main
memory. This includes Kernel or nucleus. The remainder of main memory contains user programs and
data. The allocation of this resource (main memory) is controlled jointly by the OS and memory
management hardware in the processor

Fig1.3: The Operating system as Resource manger

Page:7
computer System organization:
A modern general purpose computer system consists of one or more cpus and a number of device
controllers connected through a common bus that provides access to shared memory

Fig 1.4: A Modern Computer System

Files:
A major function of the operating system is to hide the peculiarities of the disks and other I/O devices
and present the programmer with a nice, clean abstract model of device-independent files. System calls
are obviously needed to create files, remove files, read files, and write files. Before a file can be read, it
must be opened, and after it has been read it should be closed, so calls are provided to do these things.

To provide a place to keep files, most operating system has the concept of a directory as a way of
grouping files together. A student, for example, might have one directory for each course he is taking
(for the programs needed for that course), another directory for his electronic mail, and still another
directory for his World Wide Web home page. System calls are then needed to create and remove
directories. Calls are also provided to put an existing file into a directory, and to remove a file from a
directory. Directory entries may be either files or other directories. This model also gives rise to a
hierarchy of the file system as shown in fig.

Page:8
Every file within the directory hierarchy can be specified by giving its path name from the top of the
directory hierarchy, the root directory. Such absolute path names consist of the list of directories that
must be traversed from the root directory to get to the file, with slashes separating the components. In
Fig. 1-6, the path for file CS101 is /Faculty/Prof.Brown/Courses/CS101. The leading slash indicates
that the path is absolute, that is, starting at the root directory. As an aside, in Windows, the backslash (\)
character is used as the separator instead of the slash (/) character, so the file path given above would
be written as \Faculty\Prof.Brown\Courses\CS101.

System Call:
In computing, a system call is how a program requests a service from an operating system's kernel.
This may include hardware related services (e.g. accessing the hard disk), creating and executing new
processes, and communicating with integral kernel services (like scheduling). System calls provide the
interface between a process and the operating system.
On Unix, Unix-like and other POSIX-compatible operating systems, popular system calls are open,
read, write, close, wait, execve, fork, exit, and kill. Many of today's operating systems have hundreds
of system calls. For example, Linux has over 300 different calls.

System calls can be roughly grouped into five major categories:


1. Process Control.
• load
• execute
• create process

Page:9
• terminate process
• get/set process attributes
• wait for time, wait event, signal event
• allocate, free memory
2. File management.
• create file, delete file
• open, close
• read, write, reposition
• get/set file attributes
3. Device Management.
• request device, release device
• read, write, reposition
• get/set device attributes
• logically attach or detach devices
4. Information Maintenance.
• get/set time or date
• get/set system data
• get/set process, file, or device attributes
5. Communication.
• create, delete communication connection
• send, receive messages
• transfer status information
• attach or detach remote devices

Shell:
A shell is a program that provides the traditional text only user interface for Linux and other Unix
operating system. Its primary function is to read commands typed into a console or terminal window
and then execute it. The term shell derives its name form the fact that it is an outer layer of the OS. A
shell is an interface between the user and the internal part of the operating system.
A user is in shell(i.e interacting with the shell) as soon as the user has logged into the system. A shell is
the most fundamental way that user can interact with the system and the shell hides the detail of the
underlying system from the user.
Example:
Bourne Shell
Bash shell
Korn Shell
C shell

Kernel:
In computing, the kernel is the main component of most computer operating systems; it is a bridge
between applications and the actual data processing done at the hardware level. The kernel's
responsibilities include managing the system's resources (the communication between hardware and
software components). Usually as a basic component of an operating system, a kernel can provide the
lowest-level abstraction layer for the resources (especially processors and I/O devices) that application

Page:10
software must control to perform its function. It typically makes these facilities available to application
processes through inter-process communication mechanisms and system calls.
Operating system tasks are done differently by different kernels, depending on their design and
implementation. While monolithic kernels execute all the operating system code in the same address
space to increase the performance of the system, microkernels run most of the operating system
services in user space as servers, aiming to improve maintainability and modularity of the operating
system. A range of possibilities exists between these two extremes.

Operating System Structure:


The structure of an operating system is dictated by the model employed in building them. An operating
system model is a broad framework that unifies the many features and services the operating system
provides and tasks it performs. Operating systems are broadly classified into following categories,
based on the their structuring mechanism as follows:

a. Monolithic System
b. Layered System
c. Virtual Machine
d. Exokernels
e. Client-Server Model

Monolithic System
The components of monolithic operating system are organized haphazardly and any module can call
any other module without any reservation. Similar to the other operating systems, applications in
monolithic OS are separated from the operating system itself. That is, the operating system code runs in
a privileged processor mode (referred to as kernel mode), with access to system data and to the
hardware; applications run in a non-privileged processor mode (called the user mode), with a limited
set of interfaces available and with limited access to system data. The monolithic operating system
structure with separate user and kernel processor mode is shown in Figure.

Page:11
This approach might well be subtitled "The Big Mess." The structure is that there is no structure. The
operating system is written as a collection of procedures, each of which can call any of the other ones
whenever it needs to. When this technique is used, each procedure in the system has a well-defined
interface in terms of parameters and results, and each one is free to call any other one, if the latter
provides some useful computation that the former needs.
Example Systems: CP/M and MS-DOS

Layered Operating System


The layered approach consists of breaking the operating system into the number of layers(level), each
built on the top of lower layers. The bottom layer (layer 0) is the hardware layer; the highest layer is the
user interface.
The main advantages of the layered approach is modularity. The layers are selected such that each uses
functions (operations) and services of only lower-level layers. This approach simplifies debugging and

Page:12
system verifications. That is in this approach, the Nth layer can access services provided by the (N-
1)th layer and provide services to the (N+1)th layer. This structure also allows the operating system to
be debugged starting at the lowest layer, adding one layer at a time until the whole system works
correctly. Layering also makes it easier to enhance the operating system; one entire layer can be
replaced without affecting other parts of the system.

The layer approach to design was first used in the THE operating system at the Technische Hogeschool
Eindhoven. The THE system was defined in the six layers , as shown in the fig below.

Page:13
Example Systems: VAX/VMS, Multics, UNIX

Virtual Machines:
Virtual machine approach provides an interface that is identical to the underlying bare hardware. Each
process is provided with a (virtual) copy of the underlying computer as shown in the fig. The resources
of the physical computer are shared to create the virtual machine. CPU scheduling can be used to share
the CPU and to create the appearance that users have their own processors.

Fig: a). Non Virtual Machine b). Virtual Machine.


Although the virtual machine concept is useful, it is difficult to implement. Much effort is required to
provide an exact duplicate of the underlying machine.
Example. Java

Client-Server or Microkernel
The advent of new concepts in operating system design, microkernel, is aimed at migrating traditional
services of an operating system out of the monolithic kernel into the user-level process. The idea is to
divide the operating system into several processes, each of which implements a single set of services -
for example, I/O servers, memory server, process server, threads interface system. Each server runs in
user mode, provides services to the requested client. The client, which can be either another operating
system component or application program, requests a service by sending a message to the server. An
OS kernel (or microkernel) running in kernel mode delivers the message to the appropriate server; the
server performs the operation; and microkernel delivers the results to the client in another message, as
illustrated in Figure.

Page:14
Fig: The client-server model.

Fig: The client-server model in a distributed system.

Function of Operating system:


1. Memory management function
2. processors management function
3. I/O Device management function
4. File management function

Evolution of Operating System:


Evolution of Operating Systems: User driven, operator driven, simple batch system, off – line batch
system, directly coupled off – line system, multi- programmed spooling system, online timesharing
system, multiprocessor systems, multi-computer/ distributed systems, Real time Operating Systems.
1. Serial processing
2. Batch processing
3. Multiprogramming
4. Multitasking or time sharing System

Page:15
5. Network Operating system
6. Distributed Operating system
7. Multiprocessor Operating System
8. Real Time Operating System
9. Modern Operating system

Serial Processing:
● Early computer from late 1940 to the mid 1950.
● The programmer interacted directly with the computer hardware.
● These machine are called bare machine as they don't have OS.
● Every computer system is programmed in its machine language.
● Uses Punch Card, paper tapes and language translator

These system presented two major problems.


1. Scheduling
2. Set up time:

Scheduling:
Used sign up sheet to reserve machine time. A user may sign up for an hour but finishes his job in 45
minutes. This would result in wasted computer idle time, also the user might run into the problem not
finish his job in alloted time.

Set up time:
A single program involves:
● Loading compiler and source program in memory
● Saving the compiled program (object code)
● Loading and linking together object program and common function

Each of these steps involves the mounting or dismounting tapes on setting up punch cards. If an error
occur user had to go the beginning of the set up sequence. Thus, a considerable amount of time is spent
in setting up the program to run.

This mode of operation is turned as serial processing ,reflecting the fact that users access the computer
in series.

Simple Batch Processing:


● Early computers were very expensive, and therefore it was important to maximize processor
utilization.
● The wasted time due to scheduling and setup time in Serial Processing was unacceptable.
● To improve utilization, the concept of a batch operating system was developed.
● Batch is defined as a group of jobs with similar needs. The operating system allows users to
form batches. Computer executes each batch sequentially, processing all jobs of a batch
considering them as a single process called batch processing.

The central idea behind the simple batch-processing scheme is the use of a piece of software known

Page:16
as the monitor. With this type of OS, the user no longer has direct access to the processor. Instead, the
user submits the job on cards or tape to a computer operator, who batches the jobs together sequentially
and places the entire batch on an input device, for use by the monitor. Each program is constructed to
branch back to the monitor when it completes processing, at which point the monitor automatically
begins loading the next program.

Fig.1.5: Memory Layout for resident memory

With a batch operating system, processor time alternates between execution of user programs and
execution of the monitor. There have been two sacrifices: Some main memory is now given over to the
monitor and some processor time is consumed by the monitor. Both of these are forms of overhead.

Multiprogrammed Batch System:


A single program cannot keep either CPU or I/O devices busy at all times. Multiprogramming increases
CPU utilization by organizing jobs in such a manner that CPU has always one job to execute. If
computer is required to run several programs at the same time, the processor could be kept busy for the
most of the time by switching its attention from one program to the next. Additionally I/O transfer
could overlap the processor activity i.e, while one program is awaiting for an I/O transfer, another
program can use the processor. So CPU never sits idle or if comes in idle state then after a very small
time it is again busy. This is illustrated in fig below.

Page:17
Fig 1.6. Multiprogramming example

Multitasking or Time Sharing System:


● Multiprogramming didn't provide the user interaction with the computer system.
● Time sharing or Multitasking is a logical extension of Multiprogramming that provides user
interaction.
● There are more than one user interacting the system at the same time
● The switching of CPU between two users is so fast that it gives the impression to user that he is
only working on the system but actually it is shared among different users.
● CPU bound is divided into different time slots depending upon the number of users using the
system.
● just as multiprogramming allows the processor to handle multiple batch jobs at a time,
multiprogramming can also be used to handle multiple interactive jobs. In this latter case, the
technique is referred to as time sharing, because processor time is shared among multiple users
● A multitasking system uses CPU scheduling and multiprogramming to provide each user with a
small portion of a time shared computer. Each user has at least one separate program in

Page:18
memory.
● Multitasking are more complex than multiprogramming and must provide a mechanism for jobs
synchronization and communication and it may ensure that system does not go in deadlock.

Although batch processing is still in use but most of the system today available uses the concept of
multitasking and Multiprogramming.

Distributed System:
Multiprocessor system:
- General term for the use of two or more CPUs for a computer system.
- Can vary with context, mostly as a function of how CPUs are defined.
- The term multiprocessing is sometimes used to refer to the execution of multiple concurrent software
processes in a system as opposed to a single process at any one instant.

Multiprogramming:
Multiprogramming is more appropriate to describe concept which is implemented mostly in softwares,
whereas multiprocessing is more appropriate to describe the use of multiple hardware CPUs.
A system can be both multiprocessing and multiprogramming, only one of the two or neither of the
two.

Processor Coupling:
Its the logical connection of the CPUs. Multiprocessor system have more than one processing unit
sharing memory/peripherals devices. They have greater computing power and higher reliability.
Multiprocessor system can be classified into two types:
1. Tightly coupled
2. Losely coupled(distributed). Each processor has its own memory and copy of the OS.

Tightly Coupled( Multiprocessor System): Tightly coupled multiprocessor system contain multiple
CPUs that are connected at the bus level. Each processor is assigned a specific duty but processor work
in close association, possibly sharing one memory module.
chip multiprocessors also known as multi-core computing involves more than one processor placed on
a single chip and can be thought as the most extreme form of tightly coupled multiprogramming.
Dual core, Core-2 Duo, Intel Core I5 etc are the brand name used for various mid-range to high end
consumers and business multiprocessor made by Intel.

Loosely Coupled( Distributed System):


Loosely coupled system often referred to as clusters are based on multiple stand-alone single or dual
processors commodity computers interconnected via a high speed communication system. distributed
system are connected via a distributed operating system.

Multiprocessor operating system:


Multiprocessor operating system aims to support high performance through the use of multiple CPUs.
It consists of a set of processors that share a set of physical memory blocks over an interconnected

Page:19
network. An important goal is to make the number of CPUs transparent to the application. Achieving
such transparency is relatively easy because the communication between different (parts of )
application uses the same primitives as those in uni-processor OS.
The idea is that all communication is done by manipulating data at the shared memory locations and
that we only have to protect that data segment against simultaneous access. Protection is done through
synchronization primitives like semaphores and monitors.

Fig: Multiprocessor System.

Distributed Operating System:


A recent trend in computer system is to distribute computation among several processors. In contrasts
to the tightly coupled system the processors do not share memory or a clock. Instead, each processor
has its own local memory. The processors communicate with one another through various
communication lines such as computer network. Distributed operating system are the operating system
for a distributed system( a network of autonomous computers connected by a communication network
through a message passing mechanisms). A distributed operating system controls and manages the
hardware and software resources of a distributed system. When a program is executed on a distributed
system, user is not aware of where the program is executed or the location of the resources accessed.

Fig: Architecture of a Distributed system.

Page:20
Example of Distributed OS: Amoeba, Chorus, Alpha Kernel.

Real Time Operating System:


Primary objective of Real Time Operating System is to provide quick response time and thus to meet a
scheduling deadline. User convenience and resource utilization are secondary concern to these systems.
Real time systems has many events that must be accepted and processed in a short time or within
certain deadline. Such applications include:
Rocket launching, flight control, robotics, real time simulation, telephone switching equipments etc.

Real time systems are classified into two categories:


a). Soft Real time System: If certain deadlines are missed then system continues its working with no
failure but its performance degrade.

b). Hard Real time System: If any deadline is missed then system will fail to work or does not work
properly. This system gurantees that critical task is completed on time.

Page:21

You might also like