Professional Documents
Culture Documents
Os Final Btech
Os Final Btech
Operating system
Operating System
Definitions
oA
program that manages hardware software resources of a computer when one turn ones computer on.
and
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.
System Calls
Types
Virtual Machine
System Boot
hardware so
o Bootstrap loader is a small piece of code o which locates the kernel, loads it into memory, and o starts it.
Kernel
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:
File Systems
o File systems are an integral part of any
organized
Implementation strategy
Contiguous allocation
o First implementation strategy was that of a
contiguous allocation
o Lay out of various files are in contiguous disk
blocks.
o Used in VM/CMS - an old IBM interactive
system
required.
Linked allocation
o Next implementation strategy was that of a
linked 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
FAT allocation
CareerAces
Click to edit Master subtitle style 3rd Class Process, Threads
Process
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.
sprit'
of
procedure
in
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
occur
o Ready
process
o Terminated
Thread
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.
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
Processes Vs
Threads
Similarities
o Like processes threads share CPU and only
o Like
o Like processes, thread can create children. o And like process, if one thread is blocked,
of one another.
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.
CareerAces
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.
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
parts:
o Non-preemptive scheduling scheme and o Preemptive scheduling scheme.
First-Served
algorithm
(FCFS)
o Shortest-Job-First (SJF)
o First-Come,
(FCFS)
First-Served
algorithm
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
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.
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
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.
Deadlock
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
Paging
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.
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
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
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.
Fragmentation
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.
Thrashing
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.
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
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
oNetworking
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
Applicatio Application (Upper) Layers Session Transport Layer Network Layer Data Link Physical n Presentation
OSI Model
Application
Prof essional Workstat io n 11 11
P111
SD
Presentation
Session
Transport
Network
LAN 1
LAN 2
Data link
Physical
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
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
Provides the user interface. Connects the user to the network. Provides file transfer service, mail service,
P1 1 1
SD
Professional Workstation 1 11 1
4/18/12
Establishes and maintains connection. Manages upper layer errors. Handles remote procedure calls. Synchronizes communicating nodes.
4/18/12
Takes action to correct faulty transmission. Controls the flow of data. Acknowledges successful receipt of data. Fragments and reassembles data.
4/18/12
Moves information to the correct address. Assembles and disassembles packets. Addresses and routes data packets. Determines best path for moving data through the network.
LAN 1
LAN 2
4/18/12
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
01010101001100 1
4/18/12
Provides electrical and mechanical interfaces for a network. Specifies type of media used to connect network devices.
4/18/12
Q. What is TCP/IP
4/18/12
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 provides a point-to-point channel for applications that require o TheHypertext Transfer Protocol(HTTP),File Transfer Protocol(FTP)
oriented protocol?
Connection-Oriented
o Connection-Orientedmeans that when
devices communicate, they perform handshaking to set up an end-to-end connection. in bi-directional communications environments.
be able to communicate with each other. This will not work in a unidirectional environment. Title | CONFIDENTIAL 2006 Slide
Connectionless
o Connectionlessmeans that no effort is
and hub?
information (it receives on any port) to all ports hence is called non-intelligent or dumb.
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?
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
and gateways.
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
same devices?
1,2 for transmission & 3,6 for reception. If we don't use cross cable then we can't transfer data.
its Services?
HTTP
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 achilles.mycorp.com for computers to replace numerical addresses like 123.45.67.89. 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.
SLIP/ PPP