Anda di halaman 1dari 71


Click to edit Master subtitle style

Operating system

Operating System

program that manages hardware software resources of a computer when one turn ones computer on.


o It is the first thing that is loaded into memory o A program that acts as an intermediary

between a user of a computer and computer hardware resources of a computer and provides programmers with an interface used to access those resources.

o A software that manages the sharing of the

User Operating System Interface Interface CLI o Command Line

o Graphical User Interface GUI

System Calls

Process control File management Device management Information maintenance Communications

Virtual Machine

System Boot
hardware so

o Operating system must be made available to o hardware can start it.

o Bootstrap loader is a small piece of code o which locates the kernel, loads it into memory, and o starts it.


The kernel's primary purpose is to manage the computer's resources and allow other programs to run and use the resources like the CPU, memory and the I/O devices in the computer.
The facilities provides by the kernel are:
o Memory management - The kernel has full

access to the system's memory and must allow processes to access safely this memory as they require it. management - To perform useful

o Device

Types of Kernel:
o Monolithic kernels - Every part which is to

be accessed by most programs which cannot be put in a library is in the kernel space:

o Device drivers o Scheduler o Memory handling o File systems o Network stacks

File Systems
o File systems are an integral part of any

operating systems with the capacity for long term storage.

o The mechanism for storing files and o The directory structure into which they are

o Two distinct parts of a file system


Implementation strategy
Contiguous allocation
o First implementation strategy was that of a

contiguous allocation
o Lay out of various files are in contiguous disk

o Used in VM/CMS - an old IBM interactive


o Quick and easy calculation of block holding

data - just offset from start of file

o For sequential access, almost no seeks


Linked allocation
o Next implementation strategy was that of a

linked allocation.

o All files stored in fixed size blocks. Link

together adjacent blocks like a linked list.

o No more variable-sized file allocation

problems. Everything takes place in fixed-size chunks, which makes memory allocation a lot easier.

o No more external fragmentation. o No need to compact or relocate files. o Potentially terrible performance for direct

access files - have to follow pointers from one

FAT allocation

o Next implementation strategy is FAT (File

Allocation Table) allocation

Click to edit Master subtitle style 3rd Class Process, Threads

The term "process" was first used by the designers of the MULTICS in 1960's. The process has been given many definitions for instance
o A program in Execution. o An asynchronous activity. o The

'animated execution.





o The entity to which processors are assigned. o The 'dispatch able' unit. o There is no universally agreed upon definition,

Process states
o New o Running

The process is being created Instructions are being executed

o Waiting/Blocking The process is waiting for some event to

o Ready

The process is waiting to be assigned to a The process has finished execution

o Terminated

Process Control Blocks (PCB)

A process in an operating system is represented by a data structure known as a process control block (PCB) or process descriptor. The PCB contains important information about the specific process including
o The current state of the process i.e., if it is in

ready, running, waiting.

o Unique identification of the process in order to

track the concerned process.

o A pointer to parent process. o A pointer to child process (if it exists).

Different types of Processes Cooperating Processes

A process which can affect or can be affected by other processes is called co-operating process Concurrent Process A sequential computer program consists of a series of instructions to be executed one after another. A concurrent program consists of several sequential programs to be executed in parallel. Each of the concurrently executing sequential programs is called a process Independent Process Independent process cannot affect or be

o Process has is a thread of execution o Threads add to the process model is to allow

multiple executions to take place in the same process environment, to a large degree independent of one another.

o Although a thread must execute in some

process, the thread and its process are different concepts and can be treated separately. Processes are used to group resources together; threads are the entities scheduled for execution on the CPU.
o The threads share an address space, open

files, and other resources, processes share

Three processes with one thread

One process with three threads

Processes Vs
o Like processes threads share CPU and only

one thread active (running) at a time.

o Like

processes, threads within processes, threads within a process execute sequentially.

o Like processes, thread can create children. o And like process, if one thread is blocked,

another thread can run. Differences

o Unlike processes, threads are not independent

of one another.

Multi tasking, Multi programming & Multi threading

Context Switch
To give each process on a multi programmed machine a fair share of the CPU, a hardware clock generates interrupts periodically. This allows the operating system to schedule all processes in main memory (using scheduling algorithm) to run on the CPU at equal intervals. Each time a clock interrupt occurs, the interrupt handler checks how much time the current running process has used. If it has used up its entire time slice, then the CPU scheduling algorithm (in kernel) picks a different process to run. Each switch of the CPU from one process to another is called a context switch.

4th Class Master subtitle style Click to editCPU Scheduling and IPC

CPU Scheduling
o The objective of multiprogramming is to have

some process running all the time, to maximize CPU utilization Maximum CPU utilization obtained with multiprogramming.

o CPU scheduling is the basis of multi

programmed operating systems. By switching the CPU among processes, the operating system can make the computer more productive.
o Scheduling schemes can be divided into two

o Non-preemptive scheduling scheme and o Preemptive scheduling scheme.

Non-preemptive scheduling scheme

Non-preemptive scheduling is a scheme where once a process has control of the CPU no other processes can preemptively take the CPU away. The process retains the CPU until either it terminates or enters the waiting state. There are two algorithms that can be used for non-preemptive scheduling.
o First-Come,



o Shortest-Job-First (SJF)

o First-Come,




The first process to request the CPU is the one that is allocated the CPU first and is very simple to implement. It can be managed using a First-In, First-Out (FIFO) queue. When the CPU is free, it is allocated to the first process waiting in the FIFO queue. Once that process is finished the CPU goes back to the queue and selects the first job in the queue.
o Shortest-Job-First (SJF)

In this scheduling scheme the process with the shortest next CPU burst will get the CPU first. By moving all the short jobs ahead of the

Preemptive scheduling scheme scheduling is the second Preemptive

scheduling scheme. In preemptive scheduling there is no guarantee that the process using the CPU will keep it until it is finished. This is because the running task may be interrupted and rescheduled by the arrival of a higher priority process. There are two preemptive scheduling algorithms that are preemptive.
o The Round Robin (RR) and o The Shortest Remaining Time First (SRTF)

Round-Robin (RR)
o The Round-Robin scheduling scheme is similar to that of FCFS except

preemption is added to it. In the RR scheduling scheme the CPU picks a process from the ready queue and sets a timer to interrupt after one time quantum. During this scheme two things may happen.
o The process may need less than one time quantum to execute. o The process needs more than one time quantum.

In the first case when a process is allocated the CPU it executes. Because the time required by the process is less than one time quantum, the process gives up the CPU freely. This causes the scheduler to go and select another process from the ready queue. In the second case if a process needs more than one quantum time to execute it must wait. In the RR scheme each process is given only one time quantum. The only way for the process to gain access to the CPU for more than one time quantum is if it is the only process left. If that is not the case, then after one time quantum the process will be interrupted by the timer. This will cause the process to go to the end of the ready queue. The next process in line will get allocated the CPU and will be allotted one time quantum.

Inter Process Communication (IPC)

Since processes frequently need to communicate with other processes therefore, there is a need for a well-structured communication, without using interrupts, among processes. It is a set of techniques for the exchange of data among multiple processes. Processes may be running on one or more computers connected by a network. IPC techniques are divided into methods for message passing, synchronization, shared memory, and remote procedure calls (RPC). The method of IPC used may vary based on the bandwidth and latency of communication between the process, and the type of data

Process synchronization
Process synchronization is the task of organizing the access of several concurrent processes to shared (i.e. jointly used) resources without causing any conflicts. The shared resources are most often memory locations (shared data) or some hardware. Process synchronization can be divided into two subcategories:
o Synchronizing competing processes: Several

processes compete for one exclusive resource. This is solved by one of the mutual exclusion mechanisms.
o Synchronizing cooperating processes: Several

processes have to notify each other of their

Race conditions
In operating systems, processes that are working together share some common storage (main memory, file etc.) that each process can read and write. When two or more processes are reading or writing some shared data and the final result depends on who runs precisely when, are called race conditions. Avoiding Race conditions The key to preventing trouble involving shared storage is find some way to prohibit more than one process from reading and writing the shared data simultaneously. That part of the program where the shared memory is accessed is called the Critical Section.

A set of process is in a deadlock state if each process in the set is waiting for an event that can be caused by only another process in the set. Conditions for Deadlock
o Mutual exclusion o Hold and wait o No preemption o Circular wait

Deadlock Prevention
o Elimination of Mutual Exclusion Condition o Elimination of Hold and Wait Condition o Elimination of No-preemption Condition o Elimination of Circular Wait Condition

Virtual memory
Virtual memory is hardware technique where the system appears to have more memory that it actually does. This is done by time-sharing, the physical memory and storage parts of the memory one disk when they are not actively being used.

Cache memory

Cache memory is random access memory (RAM) that a computer microprocessor can access more quickly than it can access regular RAM. As the microprocessor processes data, it looks first in the cache memory and if it finds the data there (from

o Paging

is an aspect of virtual memory addressing whereby relatively inactive pages can be temporarily removed from physical memory if necessary. be saved to a temporary storage area on disk, called a paging file or swap space.

o If these pages have been modified, they must

o The operation of writing one inactive page or

a cluster of inactive memory pages to disk is called a page out, and the corresponding operation of reading them in again later when one of the pages is referenced is called a page in.

Paging operation
o Basic idea is to allocate physical memory to

processes in fixed size chunks called page frames.

o Inside

machine, break address space of application up into fixed size chunks called pages. process generates an address, dynamically translate to the physical page frame which holds data for that page. pieces: a page number and an offset within that page.

o When

o So, a virtual address now consists of two

o To access a piece of data at a given

o System performs translation using a page

table. Page table is a linear array indexed by virtual page number that gives the physical page frame that contains that page. It contains:
o Extract page number. o Extract offset. o Check that page number is within address space

of process.
o Look up page number in page table. o Add offset to resulting physical page number o Access memory location.

Virtual to Physical memory

Fragmentation occurs in a dynamic memory allocation system when many of the free blocks are too small to satisfy any request. External Fragmentation: External Fragmentation happens when a dynamic memory allocation algorithm allocates some memory and a small piece is left over that cannot be effectively used. If too much external fragmentation occurs, the amount of usable memory is drastically reduced. Total memory space exists to satisfy a request, but it is not contiguous.

o If the number of frames allocated to a low

priority process is lower than the minimum number required by the computer architecture then we must suspend the execution of this low priority process.

o We should page out all of its remaining pages

and free all of its allocated frames. This provision introduces a swap in, swap-out level of intermediate CPU scheduling. frames it needs to support pages in active use, it will quickly page fault. The only option remains here for process is to replace some active pages with the page that requires a

o If the process does not have the number of

Real Time Operating System(RTOS)

o Real-time computing (RTC) is the study of

hardware and software systems which are subject to a "real-time constraint"i.e., operational deadlines from event to system response. correctness of the computations not only depends upon the logical correctness of the computation but also upon the time at which the result is produced. If the timing constraints of the system are not met, system failure is said to have occurred

o A real time system is one in which the


o Q. What is OSI model ? List layers.

Slide Title | CONFIDENTIAL 2006

OSI (Open Systems Interconnect)Model

Standards that ensure varying devices and products can communicate with each other over any network. This set of standards is called a model.

The International Standards Organization (ISO) created an industry wide model, or framework, for defining the rules networks should employ to ensure reliable communications. This model was termed as OSI

This network model is broken into layers, with each layer having a distinctive job in the communication process.

Groping into Layers reduces the complexity in implementing the Network Architecture Provides Compatibility and allows multi-vendor Integration

Facilitates Modularization and allows developer to swap out new changes at a particular Layer without affecing the other Layers

Slide Title | CONFIDENTIAL 2006

OSI Model Overview

Applicatio Application (Upper) Layers Session Transport Layer Network Layer Data Link Physical n Presentation

Data Flow Layers

OSI Model
Prof essional Workstat io n 11 11









Data link


Slide Title | CONFIDENTIAL 2006

o Q. Explain working of each layer.

Slide Title | CONFIDENTIAL 2006

ile Transfer, Email, Remote Login 1 File Transfer, Email, Remote Login 1 ASCII ASCII Text, Sound (syntax layer) 1 1 Text, Sound (syntax layer) Establish/manage connection 1 Establish/manage connection 1

d-to-end control & errorchecking End-to-end control & error checking (ensure complete data transfer): TCP 1 nsure complete data transfer): TCP 1

uting andand Forwarding Address: IP 1 1 Routing Forwarding Address: IP

wo party communication:Ethernet 1 1 Two party communication: Ethernet

to transmit signal; coding How to transmit signal; coding Hardware means sending dware meanson ofsending and ofa carrier and receiving data iving data on a carrier

The Application Layer

Application Application Presentatio

Provides the user interface. Connects the user to the network. Provides file transfer service, mail service,
P1 1 1

n Session Transport Network

Professional Workstation 1 11 1

Data Link Physical


The Sessions Layer


Establishes and maintains connection. Manages upper layer errors. Handles remote procedure calls. Synchronizes communicating nodes.

Presentatio n Session Session Transport Network Data Link Physical

Slide Title | CONFIDENTIAL 2006


The Transport Layer


Takes action to correct faulty transmission. Controls the flow of data. Acknowledges successful receipt of data. Fragments and reassembles data.

Presentatio n Session Transport Transport Network Data Link Physical

pt for recei n Retur er send

Slide Title | CONFIDENTIAL 2006


The Network Layer


Moves information to the correct address. Assembles and disassembles packets. Addresses and routes data packets. Determines best path for moving data through the network.

Presentatio n Session Transport Network Network Data Link Physical



Slide Title | CONFIDENTIAL 2006


The Data Link Layer


Presentatio n Session Transport Network Data Link Data Link Physical

Controls access to the communication channel. Controls the flow of data. Organizes data into logical frames. Identifies specific computer on the network. Detects errors.
Data from upper layers

10010011 0000011 1010011 0010111

Slide Title | CONFIDENTIAL 2006

01010101001100 1


The Physical Layer


Provides electrical and mechanical interfaces for a network. Specifies type of media used to connect network devices.

Presentatio n Session Transport Network Data Link Physical Physical

Slide Title | CONFIDENTIAL 2006


Q. What is TCP/IP

Slide Title | CONFIDENTIAL 2006


o TheTransmission Control Protocol(TCP) is one of the core

protocolsof theInternet Protocol Suite.

o TCP is one of the two original components of the suite,

complementing theInternet Protocol(IP), and therefore the entire suite is commonly referred to asTCP/IP. applications such as theWorld Wide Web,e-mail, andfile transfer. reliable communications.

o TCP is the protocol that major Internet applications rely on,

o TCP provides a point-to-point channel for applications that require o TheHypertext Transfer Protocol(HTTP),File Transfer Protocol(FTP)

are all examples of applications that require a reliable communication channel.

Slide Title | CONFIDENTIAL 2006

o Q . What is connection less and connection

oriented protocol?

Slide Title | CONFIDENTIAL 2006

o Connection-Orientedmeans that when

devices communicate, they perform handshaking to set up an end-to-end connection. in bi-directional communications environments.

o Connection-Oriented systems can only work

o To negotiate a connection, both sides must

be able to communicate with each other. This will not work in a unidirectional environment. Title | CONFIDENTIAL 2006 Slide

o Connectionlessmeans that no effort is

made to set up a dedicated end-to-end connection.

Slide Title | CONFIDENTIAL 2006

o What Is difference between switch

and hub?

Slide Title | CONFIDENTIAL 2006

o Hub is a multiport repeater it broadcast

information (it receives on any port) to all ports hence is called non-intelligent or dumb.

o HUB works on Physical layer where as

SWITCH works on data link layer,HUB based networks are on one collision domain where as in Switch based network switch divides networks into multiple collision domains.Switch also maintains Slide Title | CONFIDENTIAL 2006

A Simple Example Hub - Think of a postman with a letter to deliver in a row of houses, none of the houses have numbers so he has to visit each house and ask the owner if the letter is for them. Switch - All the houses are numbered, so the postman knows where to go, and doesn't have to bother any other home owners.

o Q. What is DHCP?

Slide Title | CONFIDENTIAL 2006

TheDynamic Host Configuration Protocol(DHCP) is an automatic configuration protocol used onIP networks. Computers that are connected to IP networks must be configured before they can communicate with other computers on the network. DHCP allows a computer to be configured automatically, eliminating the need for intervention by a network administrator. It also provides a central database for keeping track of computers that have been connected to the network. This prevents two computers from Slide Title CONFIDENTIAL 2006 accidentally being |configured with the

o Q. What is difference between routers

and gateways.

Slide Title | CONFIDENTIAL 2006

Difference between Router and Gateway In simpler terms a router is like a elevator in the building. It can take you to any floor [destination] and back again [source]. This would work with any routable protocol [tcp/ip, ipx, decnet..] Your first door to the elevator is your gateway. This is all your pc needs to know since the router will take it from there and make sure it gets to where you want and back again. You can access the World by going thru that first door [gateway]
Slide Title | CONFIDENTIAL 2006

Q: What is the PDU of "Network layer" and "Data link layer.

Slide Title | CONFIDENTIAL 2006

o PDU(Protocol Data Unit) for Network Layer is:

"Packet" and PDU for Data Link Layer is :"Frame"

Slide Title | CONFIDENTIAL 2006

o Why we use cross cable to connect

same devices?

Slide Title | CONFIDENTIAL 2006

o Same devices like PC-2-PC, it uses(NIC for PC)

1,2 for transmission & 3,6 for reception. If we don't use cross cable then we can't transfer data.

o While in the case of switch/hub they receive

(NIC of SWITCH/HUB)data on 1,2 & transmit on 3,6.

o Thats why we use straight cable for de-similar

host & cross cable for similar hosts.

Slide Title | CONFIDENTIAL 2006

o Q. What are associated TCP/IP Protocols &

its Services?

Slide Title | CONFIDENTIAL 2006


Associated TCP/IP Protocols & Services of the World Wide Web, facilitates retrieval This protocol, the core

and transfer of hypertext (mixed media) documents. Stands for the HyperText Transfer protocol A remote terminal emulation protocol that enables clients to log on to remote hosts on the network. Used to remotely manage network devices. Stands for the Simple Network Management Protocol. Provides meaningful names like for computers to replace numerical addresses like Stands for the Domain Name System. SLIP (Serial Line Internet Protocol) and PPP (Point to Point Protocol) encapsulate the IP packets so that they can be sent over a dial up phone connection to an access providers modem.