Vous êtes sur la page 1sur 58

ITSE 1202

Introduction to Operating Systems

Chapter - I Operating System Concepts


1.1 What is an Operating System? An operating system (OS) can be defined as a set of computer programs that acts as an intermediary between a user of a computer and the computer hardware. Operating system goals: Execute user programs and make solving user problems easier. Make the computer system convenient to use.

Use the computer hardware in an efficient manner. Four Components of a Computer System

Figure 1.1

Computer System Structure Computer system can be divided into four components o Hardware provides basic computing resources CPU, memory, I/O devices o Operating system Controls and coordinates use of hardware among various applications and users.

IBRI COLLEGE OF TECHNOLOGY

ITSE 1202

Introduction to Operating Systems o System & application programs define the ways in which the system resources are used to solve the computing problems of the users o Users People, machines, other computers Word processors, compilers, web browsers, database systems, video games

1.2 Views of OS
OS can be viewed from the perspective of what they are. These views are diverse depending on the particular view point of a user. But some of these views are discussed below. Operating system is an Inter-mediator between Hardware and Application programs / users. An Operating System is a software program or set of programs that mediate access between physical devices (such as a keyboard, monitor, disk drive etc) and application programs (such as a Word, Web browser). Operating system is a Resource Manager An operating system (OS) is the software that manages the sharing of the resources of a computer and provides resources to users for access them. The OS directs the processor in the use of the other system resources and in the timing of its execution of other programs Operating system is a Master control program. When the computer is turned on, a small "boot program" loads the operating system. Although additional modules may be loaded, as needed, the main part, known as the "kernel" resides in memory at all times. After this, the OS will load other programs as needed.

In general, OS manages following resources


Process. Memory. Input / Output. Secondary Storage. File Network

The following is the list of different operating systems: UNIX , Linux , DOS,Windows vista, Windows XP ,Windows 2003, MacOS etc.

IBRI COLLEGE OF TECHNOLOGY

ITSE 1202
Operating systems can have the following property. Multi-user: Multiprocessing: Multitasking: Multithreading: Real time:

Introduction to Operating Systems

Allows two or more users at the same time. Supports running a program on more than one CPU. Allows more than one program to run concurrently. Allows different parts of a single program to run concurrently. Responds to input instantly. General-purpose operating systems, such as DOS and UNIX are not real-time.

Operating systems provide a software platform (Environment) on top of which other programs, called application programs, can run (such as Word, Internet Explorer, Games). The application programs must be written to run on top of a particular operating system. Our choice of operating system, therefore determines to a great extent the applications we can run. For PCs, the most popular operating systems are Windows, Linux, and MacOS.

1.3 Computer System Organization Computer-system operation One or more CPUs, device controllers connect through common bus providing access to shared memory. Concurrent execution of CPUs and devices competing for memory cycles

Figure 1.2

IBRI COLLEGE OF TECHNOLOGY

ITSE 1202 Computer-System Operation

Introduction to Operating Systems

I/O devices and the CPU can execute concurrently. Each device controller is in charge of a particular device type. Each device controller has a local buffer. CPU moves data from/to main memory to/from local buffers I/O is from the device to local buffer of controller. Device controller informs CPU that it has finished its operation by causing an interrupt (via system bus).

1.4 Storage Structure


Main memory Only large storage media that the CPU can access directly. Secondary storage Extension of main memory that provides large nonvolatile storage capacity. Magnetic disks Rigid metal or glass platters covered with magnetic recording material Disk surface is logically divided into tracks, which are subdivided into sectors. The disk controller determines the logical interaction between the device and the computer.
Storage Hierarchy

Figure 1.3 IBRI COLLEGE OF TECHNOLOGY 4

ITSE 1202

Introduction to Operating Systems

Storage systems organized in hierarchy, based on the following parameters. Speed Cost Volatility

Caching copying information into faster storage system; main memory can be viewed as a last cache for secondary storage.

1.5 HISTORY (Evolution) OF OPERATING SYSTEMS


The present day operating systems have not been developed overnight. Just like any other system, operating systems also have evolved over a period of time, starting from the very primitive systems to the present day complex and versatile ones. 1.5.1 Simple Batch Systems Computers in earlier days of their inception were very bulky, large machines usually run from a console. I/O devices consisted of card readers, tape drives and line printers. Direct user interaction with the system did not exist. Users made a job consisting of programs, data and control information. The job was submitted to an operator who would execute the job on the computer system. The output appeared after minutes, hours or sometimes days. The user collected the output from the operator, which also included a memory dump. The operating system was very simple and its major task was to transfer control from one job to another. To speed up processing, jobs with the same needs were batched together and executed as a group. Thus came into existence batch operating systems.

1.5.2 Time-sharing System (Multitasking)


Another mode for delivering computing services is provided by time sharing operating systems. In this environment a computer provides computing services to several or many users concurrently on-line. Here, the various users are sharing the central processor, the memory, and other resources of the computer system in a manner facilitated, controlled, and monitored by the operating system. The user, in this environment, has nearly full interaction with the program during its execution, and the computer's response time may be expected to be no more than a few second. It allows the user interaction with the system.

IBRI COLLEGE OF TECHNOLOGY

ITSE 1202 IBM CMS. System 1 CPU

Introduction to Operating Systems

Figure 1.4 Block Diagram of a Time-sharing System (Multitasking)

1.5.3 Multiprogrammed System


Multiprogramming increase CPU utilization by organizing jobs so that the CPU always has one to execute. The operating system keeps several jobs in memory simultaneously. Thus, it is evident that a time-sharing system is a multiprogramming system, but note that a multiprogramming system is not necessarily a time-sharing system. Multiprogramming is a technique to execute number of programs simultaneously by a single processor. In Multiprogramming, number of processes resides in main memory at a time. The OS picks and begins to execute one of the jobs in the main memory. If any I/O wait happened in a process, then CPU switches from that job to another job. Hence CPU in not idle at any time. OS JOB1 . JOB2 JOB3 JOB4 Figure 1.5 depicts the layout of multiprogramming system. The main memory consists of 4 jobs at a time, the CPU executes one by one. IBRI COLLEGE OF TECHNOLOGY

ITSE 1202 Advantages: Efficient memory utilization Throughput increases CPU is never idle, so performance increases

Introduction to Operating Systems

1.5.4 Multiprocessor System


o System, which supports more than one processor. o Processor communicates with each other. o Processors Share the memory and other devices.

Advantages: More work in Less Time (Increased Throughput) Saves money by sharing Devices (Economy of Scale ) Reliability

System Mother Board Share Memor y

RAM

CPU 1

CPU2

Figure 1.6 Block Diagram of a Multiprocessor System

IBRI COLLEGE OF TECHNOLOGY

ITSE 1202

Introduction to Operating Systems

1.5.5 Distributed System


It is a collection of processors that do not share memory, devices and system clock. A distributed computing system consists of a number of computers that are connected and managed so that they automatically share the job processing load among the constituent computers, or separate the job load as appropriate particularly configured processors. Such a system requires an operating system which, in addition to the typical stand- alone functionality, provides coordination of the operations and information flow among the component computers Example ATM

Figure 1.7 Block Diagram of a Distributed System

1.5.6 Client Server System.


It consists of Client system and a Server System. 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 Client requests a service and Server Responds with a Service. Example Email

Figure 1.8 Block Diagram of a Client Server System. IBRI COLLEGE OF TECHNOLOGY 8

ITSE 1202

Introduction to Operating Systems

1.6 Services of Operating System


Program Execution. The operating system loads the contents (or sections) of a file into memory and begin its execution. I/0 Operations. Disks, tapes, serial lines, and other devices must be communicated with at a very low level. The user need only specify the device and the operation to perform on it, while the system converts that request into device or controller specific commands. File-system management. There are many details in file creation, deletion, allocation, and naming that users should not have to perform. Blocks of disk space are used by files and must be tracked. Deleting a file requires removing the name, file information and freeing the allocated blocks. Communications. Message passing between systems requires messages be turned into packets of information, sent to the network controller, transmitted across a communication medium, and reassembled by the destination system. Error detection. Error detection occurs at both the hardware and software levels. At hardware level, all data transfers must be inspected to ensure that data have not been corrupted in transmission. At the software level, media must be checked for data consistency; for instance, do the numbers of allocated and unallocated blocks of storage match the total number on the device?

IBRI COLLEGE OF TECHNOLOGY

ITSE 1202

Introduction to Operating Systems

1.7 Operating System terminologies The Kernel


It is central to the operating system. It is the part of the operating system that loads first, and it remains in main memory. Because it stays in memory, it is important for the kernel to be as small as possible. It provides all the essential services required by other parts of the operating system and applications. Typically, the kernel is responsible for memory management, process management and disk management.

User Interface.
The user interacts with the OS through the user interface.
The components of the user interface are 1. The command interpreter, 2. The file system, 3. On-line help, and 4. Application integration.

Command Interpreter / Shell


Users normally interact with the operating system through a set of commands. For example, the DOS operating system contains commands such as COPY and RENAME for copying files and changing the names of files, respectively. The commands are accepted and executed by a part of the operating system called the command processor or command line interpreter. In some operating systems, the command interpreter is called the

shell.
In some Operating systems, Graphical user interfaces (GUI) allow us to enter commands by pointing and clicking at objects that appear on the screen. OS like Windows XP, MacOS are some example for GUI.

IBRI COLLEGE OF TECHNOLOGY

10

ITSE 1202

Introduction to Operating Systems

Examples:
Below is the list of some DOS operating system commands.

1. DIR [note: Directory means Folder in windows XP] This command displays files and folders in the current directory or folder. Most of the DOS commands come with various options. They are called switches in DOS. Example with switches: DIR /AD Here the switch / AD is used with DIR command to display all the sub folders in the current directory. 2. CLS This command clears the screen.

Special switch To know syntax of a particular command with all options type Command name / ? Example: To know about COPY command type

COPY /?

Commands of UNIX

cp (Copy -- same as DOS "copy")

rm (Remove [or "delete"] a file -- same as DOS "del")

IBRI COLLEGE OF TECHNOLOGY

11

ITSE 1202

Introduction to Operating Systems

Chapter II PROCESS MANAGEMENT-I


2.1 PROCESS
A program in execution is called process. A process is executed sequentially, one instruction at a time. A program is a passive entity. For example, a file on the disk. A process on the other hand is an active entity. In addition to program code, it includes PCB.

PROCESS STATE
As a Process executes, it changes state. The state of a process is defined in which part by the current activity of that process. Each process may be in any one of the following states: New: Process being created. Running: Instructions being executed. Waiting: Process waiting for an event to occur. Ready: Process waiting for CPU. Terminated: Process has finished execution.

Process State Transition Diagram

Figure 2.1

The above diagram explains how the process transit to various states in its lifecycle by some events.

IBRI COLLEGE OF TECHNOLOGY

12

ITSE 1202

Introduction to Operating Systems

2.2 PROCESS CONTROL BLOCK


A Process Control Block (PCB) also called Task Control Block represents each process in the operating system. Every process has a process control block (PCB) which represents a process in an operating system. The PCB contains information that makes the process an active entity. Following is the list of information a PCB of a process contains: Process numbers is used to uniquely identify a process. The process state gives the current state of the process. It can be either new, ready, running, waiting or terminated. The program counter contains the address of the next instruction to be executed. The values in the CPU registers are required when the CPU switches from one process to another for a successful continuation. Memory management information is dependent on the memory system used by the operating. This includes base registers, limit registers, page tables, segment tables and other related details. I/O information gives details about the I/O devices allotted to the process, the number of files that are open and in use by the process etc.

2.3 Multi Programming and Process Scheduling


Multiprogramming is a technique used to utilize maximum CPU time by running multiple programs simultaneously. It is achieved by two ways. 1. The execution begins with the first process and continues till an instruction waiting for a peripheral is reached, the context of this process is stored, and the next process in ready queue (in memory) is given a chance to execute. This will be continued until two or more programs exist in ready queue.

2. Process gives up the CPU on expiry of its time slice and rejoins the ready queue. This will be continued until two or more programs exist in ready queue. (This is nothing but timesharing)

IBRI COLLEGE OF TECHNOLOGY

13

ITSE 1202

Introduction to Operating Systems

Ready queue

CPU

I/O

I/O request

I/O queue
Time slice expired Figure 2.2

1
2

Queuing diagram of process scheduling Scheduler Scheduler is a part of OS which selects processes from the ready queue for execution by the CPU. Different methods are applied for selecting processes from the ready queue. These methods are called Scheduling Algorithms. Note: Hence it is clear that CPU scheduling is the basis for Multiprogramming operating systems.

2.4 Major Category of CPU Scheduling


Non-preemptive : In this scheduling if a process, once selected for execution CPU keeps executing until it is released either by that process for I/O or by termination. Preemptive: In this scheduling process, can be stopped executing and returned to the ready queue to resume later.

2.5 Scheduling Criteria


Many algorithms exist for CPU scheduling. Various criteria have been suggested for comparing these CPU scheduling algorithms. All the CPU scheduling algorithms include the following criteria: 1. 2. 3. CPU utilization: Measured in Percentage of time the CPU is busy. Throughput: Number of processes completed per time unit is throughput. Turnaround time: The interval of time between submission and completion of a process is called turnaround time. It includes execution time and waiting time. 4. Waiting time: Sum of all the times spent by a process at different instances waiting in the ready queue is called waiting time. 5. Response time: Response time is the difference between time of submission and the time the first response occurs. IBRI COLLEGE OF TECHNOLOGY 14

ITSE 1202

Introduction to Operating Systems

Desirable features are having maximum CPU utilization, throughput and minimum turnaround time, waiting time and response time.

2.6 SCHEDULING ALGORITHMS


Scheduling algorithms differ in the manner in which the CPU selects a process in the ready queue for execution.

2.6.1 FIRST COME FIRST SERVE (FCFS) SCHEDULING ALGORITHM


A process that requests for the CPU first is allocated the CPU first. Hence the name first come first serve. The implementation of the FCFS policy is easily managed with a FIFO queue. When a process enters the ready queue its PCB is linked onto the tail of the queue. When the CPU is free, it is allocated to the process at the head of the queue. The running process is the removed from the queue. Even though the algorithm is simple, the average waiting is often quite long. Consider a set of three processes P1, P2 and P3 arriving at time instant 0 and having CPU burst times as shown below: Process P1 P2 P3 The Gantt chart below shows the result. P3 Burst time (msecs) 24 3 3

P1
0

P2
24 27 30 Figure 2.3 Gantt chart for above example

Average waiting time and average turnaround time are calculated as follows: The waiting time for process P1 = 0 msecs P2 = 24 msecs P3 = 27 msecs

Average waiting time

= (0 + 24 + 27) / 3 = 51 / 3 = 17 msecs.

P1 completes at the end of 24 msecs, P2 at the end of 27 msecs and P3 at the end of 30 msecs. Average turnaround time = (24 + 27 + 30) / 3 = 81 / 3 = 27 msecs.

Since the algorithm is nonpreemptive in nature, it is not suited for time sharing systems. IBRI COLLEGE OF TECHNOLOGY 15

ITSE 1202

Introduction to Operating Systems

2.6.2 SHORTEST JOB FIRST (SJF) SCHEDULING ALGORITHM


Another approach to CPU scheduling is the shortest job first algorithm. In this algorithm, the length of the CPU burst is considered. When the CPU is available, it is assigned to the process that has the smallest next CPU burst. Hence the name shortest job first. If the next CPU bursts of two processes are the same, FCFS scheduling is used to break the tie. As an example, consider the following set of processes P1, P2, P3, P4 and their CPU burst times: Process P1 P2 P3 P4 Burst time (msecs) 6 8 7 3

Using SJF algorithm, the processes would be scheduled as shown below.

P4
0 3

P1
9

P3
16

P2
24

Figure 2.4 Gantt chart for above example Average waiting time = (0 + 3 + 9 + 16) / 4 = 28 / 4 = 7 msecs. Average turnaround time = (3 + 9 + 16 + 24) / 4 = 52 / 4 = 13 msecs.

If the above processes were scheduled using FCFS algorithm, then Average waiting time = (0 + 6 + 14 + 21) / 4 = 41 / 4 = 10.25 msecs. Average turnaround time = (6 + 14 + 21 + 24) / 4 = 65 / 4 = 16.25 msecs.

It is clear that the SJF algorithm produces the most optimal scheduling scheme. For a given set of processes, the algorithm gives the minimum average waiting and turnaround times. This is because, shorter processes are scheduled earlier than longer ones and hence waiting time for shorter processes decreases and it increases the waiting time of long processes. SJF algorithm could be either preemptive or nonpreemptive. The main disadvantage with the SJF algorithm lies in knowing the length of the next CPU burst. SJF algorithm is therefore not applicable in CPU scheduling. IBRI COLLEGE OF TECHNOLOGY

16

ITSE 1202

Introduction to Operating Systems

2.6.3 Priority Scheduling


A priority is associated with each process and the CPU is allocated to the process with the highest priority. Equal-priority processes are scheduled in FCFS. An SJF algorithm is therefore simply a priority algorithm where the priority is the inverse of the (predicted) next CPU burst. The larger the CPU burst, the lower the priority and vice versa. Priority is expressed in terms of fixed range number such as 0 to 10. Some systems use low numbers to represent low priority while others use low numbers for high priority. But in this course, we will use low numbers to represent high priority. Consider the following set of processes, assumed to have arrived at time 0, in the order P1, P2, , P5, with the length of the CPU-burst time given in milliseconds:

Process P1 P2 P3 P4 P5

Burst time 10 1 2 1 5

Priority 3 1 4 5 2

Using priority scheduling, we would schedule these processes according to the Gantt chart below: P2 0 1 P5 6 P1 P3 16 18 P4 19

Figure 2.5 Gantt chart for above example Average waiting time = (0 + 1 + 6 + 16+18) / 5 = 41 / 5 = 8.2 msecs. Average turnaround time = (1 +6 + 16 + 18+19) / 5 = 60 / 5 = 12 msecs.

Priorities can be defined either internally or externally. Internally defined priorities use measurable quantity such as time limits, memory requirements, etc. to compute the priority of a process. External priorities are set by criteria that are external to the operating system such as importance of the process, amount being paid for use of the compute, the owner of the process, and other (political) factors. Priority scheduling may be either preemptive or nonpreemptive. When a process arrives at the ready queue, its priority is compared with that of the currently running process. A preemptive priorityscheduling algorithm will preempt the CPU if the priority of the newly arrived process is higher than IBRI COLLEGE OF TECHNOLOGY

17

ITSE 1202

Introduction to Operating Systems

that of the currently running process. A nonpreemptive priority-scheduling algorithm will simply put the new process at the head of the ready queue. The major disadvantage of priority-scheduling algorithms is indefinite blocking or starvation. A situation whereby low priority processes indefinitely wait for the CPU because of a steady stream of higher- priority processes. A solution to indefinite blocking of low-priority processes is aging. Aging is a technique of gradually increasing the priority of processes that wait in the system for a long time.

2.6.4 ROUND ROBIN (RR) SCHEDULING ALGORITHM


The round-robin CPU scheduling algorithm is basically a preemptive scheduling algorithm designed for time-sharing systems. One unit of time is called a time slice. Duration of a time slice may range between 10 msecs. and about 100 msecs. The CPU scheduler allocates to each process in the ready queue one time slice at a time in a round-robin fashion. Hence the name round-robin. Consider the same example explained under FCFS algorithm.

Process A B C D

Burst time (msecs) 13 3 3 5

Let the duration of a time slice be 4 msecs, which is to say CPU switches between processes every 4 msecs in a round-robin fashion. The Gantt chart below shows the scheduling of processes.

A
0 4

B
7

C
10

D
14

A
18

D
19

A
23

A
24

Figure 2.5 Gantt chart for above example Average waiting time = [(19 8) + 4 + 7+ (18 - 4)] / 3 = 36/ 4 = 9 msecs.

The performance of the RR algorithm is very much dependent on the length of the time slice. If the duration of the time slice is indefinitely large then the RR algorithm is the same as FCFS algorithm. If the time slice is too small, then the performance of the algorithm deteriorates because of the effect of frequent context switching. IBRI COLLEGE OF TECHNOLOGY 18

ITSE 1202 Exercise

Introduction to Operating Systems

Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:

Process

Burst time

Priority

P1 P2 P3 P4 P5

10 4 2 6 5

2 3 1 4 5

The processes are assumed to have arrived in the order P1, P2, P3, P4, and P5 all at time 0. a. Draw four Gantt charts illustrating the execution of these processes using FCFS, SJF, a nonpreemptive priority (a smaller priority number implies a higher priority),and RR (Quantum = 1) scheduling. b. What is the turnaround time of each process for each of the scheduling algorithms in (a) above? c. What is the waiting time of each process for each of the scheduling algorithms in (a)? d. Which of the schedules in (a) results in the minimal average waiting time (over all processes)?

IBRI COLLEGE OF TECHNOLOGY

19

ITSE 1202

Introduction to Operating Systems

Chapter III PROCESS MANAGEMENT-II 3.1 Deadlock


A process request resources; and if the resources are not available at that time, the process enters a waiting state. A waiting process is never again able to change state, because other waiting processes hold the resources. This situation is called a deadlock. Example System has two tape drives R1 and R2 and two process P1 and P2 P1 holds R1 but demand R2 P2 holds R2 but demand R1

System Model Resource types R1, R2 .Rm (CPU cycles, memory space, I/O devices) Each resource type Ri has Wi instances.(More than One Instances) Each process utilizes a resource as follows: Request Use Release

3.2 Deadlock Characterization


Deadlock can arise if four conditions hold simultaneously Mutual exclusion: At least one resource must be held in a non-sharable mode; i.e. only one process at a time can use the resource. If another process requests that resource, the requesting process must be delayed until the resource has been released. Hold and wait: a process holding at least one resource is waiting to acquire additional resources held by other processes. No preemption: a resource can be released only voluntarily by the process holding it, after that process has completed its task. Circular wait: there exists a set {P0, P1, , P0} of waiting processes such that P0 is waiting for a resource that is held by P1, P1 is waiting for a resource that is held by P2, , Pn1 is waiting for a resource that is held by Pn, and P0 is waiting for a resource that is held by P0.

IBRI COLLEGE OF TECHNOLOGY

20

ITSE 1202 3.3 Methods for Handling Deadlocks Ensure that the system will never enter a deadlock state.

Introduction to Operating Systems

Allow the system to enter a deadlock state and then recover. Ignore the problem and pretend that deadlocks never occur in the system; used by most operating systems, including UNIX.

3.3.1 Deadlock Prevention


As you have seen Deadlock Characterization for a deadlock to occur, each of the four necessary conditions must hold. By ensuring that at least one of the four necessary conditions cannot hold, you can prevent the occurrence of a deadlock. Mutual Exclusion The mutual exclusion condition must hold for non-sharable resources. For instance, a printer cannot be simultaneously shared by several processes. Sharable resources, do not require mutually exclusive access, and thus cannot be involved in a deadlock. In general, however, we cannot prevent deadlocks by denying the mutual-exclusion condition: Some resources are intrinsically non-sharable. Hold and Wait To ensure that the hold-and-wait condition never occurs, in the system, we must guarantee that, whenever a process requests a resource, it does not hold any other resources. We can implement this the following protocol. One protocol that can be used requires each process to request and be allocated all resources before it begins execution. An alternative protocol allows a process to request resources only when the process has none. A process may request some resources and use them. Before it can request any additional resources, however, it must release all the resources that it is currently allocated. No Preemption If a process that is holding some resources requests another resource that cannot be immediately allocated to it, then all resources currently being held are released. Preempted resources are added to the list of resources for which the process is waiting. Process will be restarted only when it can regain its old resources, as well as the new ones that it is requesting.

IBRI COLLEGE OF TECHNOLOGY

21

ITSE 1202 Circular Wait

Introduction to Operating Systems

Impose a total ordering of all resource types, and require that each process requests resources in an increasing order of enumeration.

3.3.2 Deadlock Avoidance


Simplest and most useful model requires that each process declare the maximum number of resources of each type that it may need. The deadlock-avoidance algorithm dynamically examines the resource-allocation state to ensure that there can never be a circular-wait condition. Resource-allocation state is defined by the number of available and allocated resources, and the maximum demands of the processes. Safe State When a process requests an available resource, system must decide if immediate allocation leaves the system in a safe state. System is in safe state if there exists a safe sequence of all processes. Sequence <P1, P2, , Pn> is safe if for each Pi, the resources that Pi can still request can be satisfied by currently available resources + resources held by all the Pj, with j<I. If Pi resource needs are not immediately available, then Pi can wait until all Pj have finished. When Pj is finished, Pi can obtain needed resources, execute, return allocated resources, and terminate. When Pi terminates, Pi+1 can obtain its needed resources, and so on. Basic Facts If a system is in safe state, no deadlocks. If a system is in unsafe state, possibility of deadlock. Avoidance ensures that a system will never enter an unsafe state.

Resource-Allocation Graph Algorithm (Single Instance of Each Resource Type)


Claim edge Pi Rj indicated that process Pj may request resource Rj; represented by a dashed line. Claim edge converts to request edge when a process requests a resource. When a process releases a resource, assignment edge, reconverts to a claim edge. Resources must be claimed a priori in the system

IBRI COLLEGE OF TECHNOLOGY

22

ITSE 1202

Introduction to Operating Systems

Resource-Allocation Graph for Deadlock Avoidance Figure 3.1

Unsafe State in a Resource-Allocation Graph

Bankers Algorithm (Several Instance of Each Resource Type)


Multiple instances. Each process must a priori claim maximum use. When a process requests a resource it may have to wait. When a process gets all its resources it must return them in a finite amount of time. Data Structures for the Bankers Algorithm Available: Vector of length m. If available [j] = k, there are k instances of resource type Rj available. Max: n x m matrix. If Max [i,j] = k, then process Pi may request at most k instances of resource type Rj. Allocation: n x m matrix. If Allocation[i,j] = k then Pi is currently allocated k instances of Rj. Need: n x m matrix. If Need[i,j] = k, then Pi may need k more instances of Rj to complete its task. Need [i,j] = Max[i,j] Allocation [i,j]. Let n = number of processes

3.3.3 Deadlock Detection


Allow system to enter deadlock state Detection algorithm Recovery scheme Single Instance of Each Resource Type Maintain wait-for graph Nodes are processes. Pi Pj if Pi is waiting for Pj. Periodically invoke an algorithm that searches for a cycle in the graph. IBRI COLLEGE OF TECHNOLOGY 23

ITSE 1202

Introduction to Operating Systems

An algorithm to detect a cycle in a graph requires an order of n2 operations, where n is the number of vertices in the graph.

Resource-Allocation Graph Several Instances of a Resource Type

Corresponding wait-for graph

Figure 3.2

Available: A vector of length m indicates the number of available resources of each type. Allocation: An n x m matrix defines the number of resources of each type currently allocated to each process. Request: An n x m matrix indicates the current request of each process. If Request [ij] = k, then process Pi is requesting k, more instances of resource type Rj.

3.3.4 Recovery from Deadlock:


Process Termination

Abort all deadlocked processes.


This method clearly will break the deadlock cycle, but at a great expense; these processes may have computed for a long time, and the results of these partial computations must be discarded and probably recomputed later.

Abort one process at a time until the deadlock cycle is eliminated.


This method incurs considerable overhead, since, after each process is aborted, a deadlock-detection algorithm must be invoked to determine whether any processes are still deadlocked. In which order should we choose to abort? Priority of the process. How long process has computed, and how much longer to completion. Resources the process has used. Resources process needs to complete. IBRI COLLEGE OF TECHNOLOGY

24

ITSE 1202 How many processes will need to be terminated? Is process interactive or batch?

Introduction to Operating Systems

Resource Preemption To elimination deadlocks using resource preemption, we successfully preempt some resources from processes and give these resources to other processes until the deadlock cycle is broken. If preemption is required to deal with deadlocks, then three issues need to be addressed: Selecting a victim minimize cost. Rollback return to some safe state, restart process from that state. Starvation same process may always be picked as victim, include number of rollback in cost factor.

IBRI COLLEGE OF TECHNOLOGY

25

ITSE 1202

Introduction to Operating Systems

Chapter IV INTER-PROCESS COMMUNICATIONS


The operating system provides mechanisms for communications and data sharing between applications/process. Collectively, these mechanisms are called interprocess communications (IPC). Some forms of IPC facilitate communication among several processes in same computer. Other forms of IPC facilitate communication among processes in different computers on a network.

4.1 Commonly used methods to achieve IPC:


Message Passing by system call In this method one process communicate with other process through Kernel. If process 1 need to pass a message to process 2 it will make a request to kernel then kernel send the request to process 2. In other words we say that Process 1 make system call to communicate with process 2 (since kernel is used).

request

request

process 1 ----------------> Kernel ---------------> Process 2 System call It is easy to implement this method but very expensive since kernel is involved. Shared memory

In this method two or more processes can use a common memory area to pass message among them. It is inexpensive compare to previous method but need protection mechanism for memory. RPC

In this method two processes in different computers in a network can pass message. It provides automatic data conversion and communications with other operating systems.

4.2 The following IPC mechanisms are supported by Windows: ( reference : http://msdn.microsoft.com/en-us/library/ ) Clipboard COM File Mapping Using a Mailslot for IPC Pipes RPC

IBRI COLLEGE OF TECHNOLOGY

26

ITSE 1202

Introduction to Operating Systems

Using the Clipboard for IPC

The clipboard acts as a central store for data sharing among applications. When a user performs a cut or copy operation in an application, the application puts the selected data on the clipboard in standard format. Using COM for IPC This enables an application to include embedded or linked data that, when chosen, automatically starts another application for data editing. Using a File Mapping for IPC File mapping enables a process to treat the contents of a file as if they were a block of memory in the process's address space. File mapping is an efficient way for two or more processes on the same computer to share data, but user must provide synchronization between the processes. Using a Mail slot for IPC Mail slots offer an easy way for applications to send and receive short messages. They also provide the ability to broadcast messages across all computers in a network domain. Using Pipes for IPC Anonymous pipes provide an efficient way to redirect standard input or output to child processes on the same computer. Named pipes provide a simple programming interface for transferring data between two processes, whether they reside on the same computer or over a network. (Shared memory) Using RPC for IPC RPC enables applications to call functions remotely. Therefore, RPC makes IPC as easy as calling a function. RPC operates between processes on a single computer or on different computers on a network.

IBRI COLLEGE OF TECHNOLOGY

27

ITSE 1202

Introduction to Operating Systems

Chapter - V
MEMORY MANAGEMENT
5.1 Need for Memory management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable supply of ready processes to consume available processor time. The three major activities of an operating system in regard to memory management. Keep track of which parts of memory are currently being used and by whom. Decide which processes are to be loaded into memory when memory space becomes available. Allocate and deallocate memory space as needed.

OS manages memory in lot of ways. Virtual memory is the best example to understand the memory management in OS. 5.2 Virtual Memory: It is a temporary storage used by a computer to run programs that need more memory than the computer has.
If computer lacks the RAM space needed to run a program or operation, OS uses virtual memory to compensate. Virtual memory combines computers RAM with temporary space on hard disk. When RAM runs low, OS moves some data from RAM to a place in a disk called a paging file to create free space in RAM.

Role of OS
Selecting portion of RAM and moving data to and from the paging file is the service of OS. Different OS apply different method in selecting portion of RAM for swapping.

Note:
1. Moving data to and from the paging file, which is in hard disk, is called Swapping.

2. Each process/program is divided in to small fixed parts called Pages and loaded into memory (need not be contiguous).

IBRI COLLEGE OF TECHNOLOGY

28

ITSE 1202

Introduction to Operating Systems

Figure 5.1

5.3 Page replacement algorithms


These algorithms decide which memory page to swap out (write to disk) when a new page of memory needs to be allocated provided there is no space in memory. Here the goal is to minimize the number of page faults.

5.3.1 First-in, first-out Algorithm


The simplest page-replacement algorithm is a FIFO algorithm. The first-in, first-out (FIFO) page replacement algorithm is a low-overhead algorithm. The idea is obvious from the name - the operating system keeps track of all the pages in memory in a queue, with the most recent arrival at the back, and the earliest arrival in front. When a page needs to be replaced, the page at the front of the queue (the oldest page) is selected. While FIFO is cheap and intuitive, it performs poorly in practical application.

Memory with 3 pages

Figure 5.2

This algorithm yields 12 page faults

IBRI COLLEGE OF TECHNOLOGY

29

ITSE 1202

Introduction to Operating Systems

5.3.2 Optimal Algorithm


It replaces the page that will not be used for the longest period of time. An optimal page replacement algorithm has the lowest page-fault rate of all algorithms. Use of these page replacement algorithm guarantees the lowest possible page fault rate for fixed number of frames.
Memory reference sequence

Memory with 3 pages

Figure 5.3

This algorithm yields 6 page faults


This above picture explains the way how the Optimal Algorithm selects pages in memory to swap out. This algorithm is difficult to implement, because it requires future knowledge It is used mainly for comparison studies.

5.3.3 LRU (Least recently used)


If we use the recent past as an approximation of the near future, then we can replace the page that has not been used for the longest period of time.LRU replacement associates with each page the time of that pages last use. When a page must be replaced, LRU chooses the page that has not been used for the longest period of time. We can think of this strategy as the optimal page replacement algorithm looking backward in time, rather than forward.

Figure 5.4

This algorithm yields 9 page faults

IBRI COLLEGE OF TECHNOLOGY

30

ITSE 1202

Introduction to Operating Systems

Page fault:
A page fault occurs when a memory reference is made to a page that is not in memory. If it occur then swap in should be needed. So more time wasted for I/O operation with Disk devices.

Best Algorithm:
It is the one, which gives less number of page faults.

IBRI COLLEGE OF TECHNOLOGY

31

ITSE 1202

Introduction to Operating Systems

Chapter - VI Operating Systems Design Principles


Security Elegance Resilience Extensibility Distribution Reliability Reversibility Simplicity 6.1 Security Security has two halves: preventing users from accessing objects they have no right to access and allowing users to access objects they have every right to access. Example 1: Windows Firewall It is software that checks information coming from the Internet or a network, and then either blocks it or allows it to pass through to user computer, depending on user firewall settings. A firewall can help prevent hackers or malicious software from gaining access to user computer through a network or the Internet. The following illustration shows how a firewall works:

Figure 6.1

IBRI COLLEGE OF TECHNOLOGY

32

ITSE 1202

Introduction to Operating Systems

Firewall settings 1. On (recommended) This setting is selected by default. When Windows Firewall is on, most programs are blocked from communicating through the firewall. If user want to allow a program, user can add it to the Exceptions list (on the Exceptions tab). For example, user might not be able to send photos in an instant message until user add the instant messaging program to the Exceptions list.. 2. Block all incoming connections This setting blocks all unsolicited attempts to connect to user computer. Use this setting when user need maximum protection for user computer, such as when user connect to a public network in a hotel or airport, or when a computer worm is spreading over the Internet. With this setting, user are not notified when Windows Firewall blocks programs, and programs on the Exceptions list are ignored. When user select Block all incoming connections, user can still view most WebPages, send and receive e-mail. 3. Notify me when Windows Firewall blocks a new program If you select this check box, Windows Firewall will inform you when it blocks a new program and give you the option of unblocking that program. 4. Off (not recommended) Avoid using this setting unless users have another firewall running on user computer. Turning off Windows Firewall might make user computer more vulnerable to damage from hackers and malicious software (such as worms).

IBRI COLLEGE OF TECHNOLOGY

33

ITSE 1202

Introduction to Operating Systems

6.2 User Accounts & Groups in Windows Local and Domain User Accounts
Windows XP supports two kinds of users: local users and domain users. A computer that is running Windows XP Professional has the ability to store its own user accounts database. The users stored at the local computer are known as local user accounts. Active Directory is a directory service that is available with the Windows Server 2003 and Windows 2000 Server. It stores information in a central database that allows users to have a single user account for the network. The users stored in Active Directorys central database are called domain user accounts.

Built-in Accounts
By default, a computer that is installed with Windows XP Professional in a workgroup has five user accounts: Administrator: The Administrator account is a special account that has full control over the computer. User provide a password for this account during XP installation. The Administrator account can perform all tasks, such as creating users and groups, managing the file system, and setting up printing. Guest: The Guest account allows users to access the computer even if they do not have a unique username and password. Because of the inherent security risks associated with this type of user, the Guest account is disabled by default. When this account is enabled, it is usually given very limited privileges. Initial user: The initial user account uses the name of the registered user. This account is created only if the computer is installed as a member of a workgroup, rather than as part of a domain. By default, the initial user is a member of the Administrators group.

IBRI COLLEGE OF TECHNOLOGY

34

ITSE 1202 Help Assistant:

Introduction to Operating Systems

The Help Assistant account is used in conjunction with the Remote Desktop Help Assistance feature. Support_xxxxxxx: Microsoft uses the Support_xxxxxxx account for the Help and Support Service. This account is disabled by default

Creating New Users


To create users on a Windows XP Professional computer, user must be logged on as a user with permissions to create a new user, or user must be a member of the Administrators group or Power Users group. Disabling User Accounts When a user account is no longer needed, the account should be disabled or deleted. After userve disabled an account, user can later enable it again to restore it with all of its associated user properties. An account that is deleted, however, can never be recovered.

Example 1: User might disable an account because a user will not be using it for a period of time, perhaps because that employee is going on vacation or taking a leave of absence. Another reason to disable an account is that userre planning to put another user in that same function. For example, suppose that Rick, the engineering manager, quits. If user disable his account, when user company hires a new engineering manager, user can simply rename Ricks user account (to the usernamefor the new manager) and enable that account. This ensures that the user who takes over Ricks position will have all the same user properties and own all the same resources. Example 2: Disabling accounts also provides a security mechanism for special situations. For example, if user company were laying off a group of people, a security measure would be to disable their accounts at the same time the layoff notices were given out. This prevents those users from inflicting any damage to the companys files on their way out.

Deleting User Accounts


User should delete a user account if user are sure that the account will never be needed again. After deleting account user will not be able to re-create or re-access the account.

IBRI COLLEGE OF TECHNOLOGY

35

ITSE 1202

Introduction to Operating Systems

6.3 Properties of User Account: User profile User profiles contain information about the Windows XP environment for a specific user. For example, profile settings include the Desktop arrangement, program groups, and screen colors that users see when they log on. The first time users log on, they receive a default user profile. A folder that matches the users logon name is created for the user in the Documents and Settings folder. Logon script Logon scripts are files that run every time a user logs on to the network. They are usually batch files, but they can be any type of executable file.

User might use logon scripts to set up drive mappings or to run a specific executable file each time a user logs on to the computer Home folder Users normally store their personal files and information in a private folder called a home folder. In the Profile tab of the user Properties dialog box, user can specify the location of a home folder as a local folder or a network folder.

6.4 Creating and Managing Groups


A user group is a collection of user accounts that all have the same security rights. A user account can be a member of more than one group. The two most common user groups are the standard user group and the administrator group, but there are others. A user account is often referred to by the user group it's in. If user have an administrator account, user can create custom user groups, move accounts from one group to another, and add or remove accounts from different groups. When user create a custom user group, user can choose which rights to assign. IBRI COLLEGE OF TECHNOLOGY 36

ITSE 1202 Default Local Groups

Introduction to Operating Systems

A local group is a group that is stored on the local computers accounts database. These are the groups user can add users to and can manage directly on a Windows XP Professional computer. By default, the following local groups are created on Windows XP Professional computers:

The Administrators Group The Administrators group has full permissions and privileges. Its members can grant themselves any permission they do not have by default, to manage all the objects on the computer. (Objects include the file system, printers, and account management.) By default, the Administrator and initial user account are members of the Administrators local group. The Backup Operators Group Members of the Backup Operators group have permissions to back up and restore the file system, even if the file system is NTFS and they have not been assigned permissions to access the file system. However, the members of Backup Operators can access the file system only through the Backup utility. To access the file system directly, Backup Operators must have explicit permissions assigned. There are no default members of the Backup Operators local group. The Guests Group The Guests group has limited access to the computer. This group is provided so that user can allow people who are not regular users to access specific network resources. As a general rule, most administrators do not allow Guest access because it poses a potential security risk. By default, the Guest user account is a member of the Guests local group. The Network Configuration Operators Group Members of the Network Configuration Operators group have some administrative rights to manage the computers network configuration, for example editing the computers TCP/IP settings. The Power Users Group The Power Users group has fewer rights than the Administrators group but more rights than the Users group. There are no default members of the Power Users local group. The Remote Desktop Users Group The Remote Desktop Users group allows members of the group to log on remotely for the purpose of using the Remote Desktop service. The Replicator Group IBRI COLLEGE OF TECHNOLOGY

37

ITSE 1202

Introduction to Operating Systems

The Replicator group is intended to support directory replication, which is a feature used by domain servers. Only domain users who will start the replication service should be assigned to this group. The Replicator local group has no default members.

The Users Group The Users group is intended for end users who should have very limited system access. If user have installed a fresh copy of Windows XP Professional, the default settings for the Users group prohibit its members from compromising the operating system or program files. By default, all users who have been created on the computer, except Guest, are members of the Users local group The Help Services Group The HelpServicesGroup group has special permissions needed to support the computer through Microsoft Help Services.

6.5 File / Folder Permission


Full Control This permission allows the following rights: Traverse folders and execute files (programs) in the folders. The ability to traverse folders allows user to access files and folders in lower subdirectories, even if user do not have permissions to access specific portions of the directory path. List the contents of a folder and read the data in a folders files. See a folders or files attributes. Change a folders or file is attributes. Create new files and write data to the files. Create new folders and append data to the files. Delete subfolders and files. Delete files. Compress files. Change permissions for files and folders. Take ownership of files and folders. Modify This permission allows the following rights: IBRI COLLEGE OF TECHNOLOGY

38

ITSE 1202 Traverse folders and execute files in the folders.

Introduction to Operating Systems

List the contents of a folder and read the data in a folders files. See a files or folders attributes. Change a files or folders attributes. Create new files and write data to the files. Create new folders and append data to the files. Delete files. Read & Execute This permission allows the following rights: Traverse folders and execute files in the folders. List the contents of a folder and read the data in a folders files. See a file or folders attributes. List Folder Contents This permission allows the following rights: Traverse folders. List the contents of a folder. See a file or folders attributes. Read This permission allows the following rights: List the contents of a folder and read the data in a folders files. See a files or folders attributes. View ownership. Write This permission allows the following rights: Overwrite a file. View files ownership and permissions. Change a files or folders attributes. Create new files and write data to the files. Create new folders and append data to the files. Simplicity Simplicity doesn't mean that the OS is weak or that it provides few abstractions. What it means is that each abstraction is simple and components of the OS have simple sets of abstractions. Using different storage devices like hard drive, flash drive, CD drive etc. is more or less same (Simple). IBRI COLLEGE OF TECHNOLOGY

39

ITSE 1202 Resilience

Introduction to Operating Systems

A system (network or service, for example) is called resilient if it can bounce back from partial or complete failures, attacks, and sabotage. It is closely associated with graceful degradation and a necessary component of survivability, though resilience doesn't imply continuous service through the duration of the attack.

Resilience of the Operating System would be its ability to restore service (or be restored to service) if broken or attacked. Example: Resiliency in Windows Installer Robustness Robustness of system means it is resistance to failure from outside stimuli. In other words, no amount of user-generated or environmentally-generated input can cause the system to fail. Robust means it's hard to break. Resilient means that it bounces back quickly when it breaks (either it self-repairs or is simply easy to fix). Uniformity Components should obey the same syntax; have the same meta-interface. Distribution Sharing of resources among users or processes. Example : Folder sharing, Printer sharing, internet connection sharing etc.

IBRI COLLEGE OF TECHNOLOGY

40

ITSE 1202

Introduction to Operating Systems

Chapter -VII Input Output in Operating System


7.1 Input / Output Management
Goal Device independence Programs can access any I/O devices without specifying device in advance Uniform naming Name of a file or device should simply be a string or an integer Error handling Handle as close to the hardware as possible Buffering Data coming off the device cannot be stored in final destination directly. Buffer is a temporary area in a memory of computer or device. Shared and dedicated devices. Dedicated (UN sharable) devices create problems such as deadlocks.

7.2 Device controller or I/O module (who is performing I/O?)


I/O module is a separate processor (called I/O processor) It has its own local memory It is a computer in its own right

Different Types of I/O (How I/O performed?) Programmed I/O Under direct control of CPU CPU issues a command on behalf of a process to an I/O module CPU then waits for the operation to be completed before proceeding IBRI COLLEGE OF TECHNOLOGY 41

ITSE 1202 Interrupt driven I/O

Introduction to Operating Systems

CPU issues a command on behalf of a process to an I/O module If the I/O instruction is nonblocking, CPU continues to execute next instruction[s] from the same process If the I/O instruction is blocking, OS takes over, suspends the current process, and assigns CPU to another process Direct memory access (DMA)

DMA module controls exchange of data between memory and an I/O module CPU sends a request to transfer a block of data to the DMA module and is interrupted only after the entire block has been transferred DMA module takes over control of system bus to perform the transfer CPU initiates the I/O by sending the following information to DMA module

I/O scheduler It is a part of OS -like CPU scheduler .It schedules I/O jobs in a computer system. It decides the order of I/O jobs that will be submitted to the disk subsystem. Best disk scheduler is the one which take less average access time for set of I/O jobs. Access time is calculated by Access time = seek time + latency time

Seek time

Time needed to place the read write head from the current track to required track. Latency time

Time needed to place the read write head from the current sector to required sector. 7.3 Managing hardware devices in OS. Most of the modern operating system provides tool to manage devices in computer. This tool is called device manager in windows operating system. The specific actions that can be taken through Device Manager include the following: Viewing a list of all hardware that is installed on user computer Determining which device driver is installed for each device Updating device drivers Changing hardware settings Disabling, enabling, and uninstalling devices IBRI COLLEGE OF TECHNOLOGY 42

ITSE 1202

Introduction to Operating Systems

Using driver rollback to roll back to a previous version of a driver Troubleshooting device problems Printing a summary of all devices that are installed on user computer

7.4 Device Driver A device driver is software that allows a specific device to communicate with the Operating system. A device driver essentially converts the more general input/output instructions of the operating system to messages that the device type can understand.

Without exact driver software, the hardware user connectfor example, a video card or a printer will not work properly or will not work at all. In most cases driver software for the devices on the OSs Hardware Compatibility List (HCL) are included in OS itself.

Note: HCL is a list of devices compatible to an operating system. This list varies from OS to OS.

IBRI COLLEGE OF TECHNOLOGY

43

ITSE 1202

Introduction to Operating Systems Figure 7.1 Logical positioning of device drivers.

Managing device drivers: It involves Updating them when necessary Device manufacturers periodically update device drivers to add functionality or enhance driver performance. The updated drivers are typically posted on the manufacturers website. Deciding how to handle drivers that may not have been properly tested. In the past, poorly written device drivers have caused problems in OS. Now OS has mechanism called driver signing * as a way of ensuring that drivers are properly tested before they are released to the public. * Note: A signed driver is device driver software that includes a digital signature. A digital signature is an electronic security mark that can indicate the publisher of the software. 7.5 Service: A system service is a program or process that performs a specific function within the operating system. In general, a program or process that runs in the background and provides support to other programs are called service. Examples for standard services in Windows ServiceName Automatic Updates Background Intelligent Service Computer Browser This maintained list of resources (computers) is displayed in Network Neighborhood and Server Manager. If disabled user can still map drives, but can't browse the whole network. IBRI COLLEGE OF TECHNOLOGY 44 Transfer Description Enable the download and installation of critical Windows updates. Transfer files using idle network bandwidth; maintain file transfers through network disconnections and computer restarts.

ITSE 1202 Error Service Event Log Fax Service Human Interface Reporting

Introduction to Operating Systems Report errors back to Microsoft in Redmond.

Record system, Security and Application Events. Send and receive faxes Support for extra keyboard 'hot buttons' and other multimedia input devices. CD-Rom Burning

Device Access IMAPI CD-Burning

COM Service MS Software Shadow CopyProvider Service Plug and Play Server Plug and play .Do not disable this service. Support for peer-to peer file sharing, print sharing, and named pipe sharing via SMB services. Shell Detection System Service Task Scheduler or This service is required to schedule background tasks (run at a specific date & Time) Allows a remote user to log on to the system and run console programs using the command line. Required for Fast User Switching, Remote Desktop and Remote Assistance Volume Copy Shadow MS Backup - A volume shadow copy is a picture of the volume at a particular moment in time. That means a computer can be backed up while files are open and applications running. Windows Audio Note that disabling the sound driver won't stop sounds from playing - user IBRI COLLEGE OF TECHNOLOGY Restore Creates system snap shots [ RESOURCE HOG] Hardware CD Auto play Microsoft Backup Utility

Schedule Telnet (Win 2K) Terminal Services

45

ITSE 1202 just won't hear them.


Windows Firewall (XP SP2)

Introduction to Operating Systems

Network address translation, addressing, and name resolution services for all computers on user home network through a dial-up connection.

Windows Time

Update the computer clock by reference to an internet time source Table 7.2

User operations on system services: User can do following operations in most of the services. Stop Start Startup type o Disable o Automatic o Manual Dependencies in services Some services are depending on other services. Example Computer browser is dependent on Server service. When user disable Server service then computer browser service will not work Sharing a printer If user have a printer attached to user computer, user can share it with anyone on the same network. It doesn't matter what type of printer it is, as long as the printer is installed on user computer and directly attached with a universal serial bus (USB) cable or other type of printer cable. Whoever user choose to share the printer with will be able to use it to print, provided they can locate user computer on the network. Note Printers that are directly connected to a network rather than attached to a computer are available to anyone on the same network. Such printers must have a network port or wireless connection that allows them to connect directly to the network. Configuring a Modem Dial-up networking allows remote users (for example, a person working from home or someone with a laptop on a business trip) to dial into a corporate network or the Internet. The most common method for remote network access is using a modem Configuring Modem Properties IBRI COLLEGE OF TECHNOLOGY 46

ITSE 1202 User can set the following options:

Introduction to Operating Systems

a) The Speaker Volume is used to troubleshoot a modem that was not working properly b) The Maximum Port Speed (specified in bits per second), which should be left at the default value c) Dial Control, to wait for a dial tone before dialing, so that dialing is not initiated prior to confirming that a valid dial tone exists

Running Modem Diagnostics We can query the modem. This process can be used in troubleshooting to ensure that the modem is properly responding to requests. A Device Manager will test the modem by issuing a series of modem commands. These commands and the responses sent back from the modem are listed in the Command/Response section of the Diagnostics tab dialog box. The View Log button is used to view the log file that records all of the commands sent to the modem by communication programs or the operating system.

IBRI COLLEGE OF TECHNOLOGY

47

ITSE 1202

Introduction to Operating Systems

Chapter - VIII File Management System


8.1 Introduction to Files File Management System is considered as a part of the operating system. Input to applications is by means of a file. Output is saved in a file for long-term storage. Four terms are in use when discussing files File It is a data collections which has the following properties Long-term existence (since stored on disk) Sharable between processes (by access permissions) Structure ( convenient for particular applications) Field (A field is the basic element of data. e.g.: employee name, date ...etc) Record (Collection of related fields that can be treated as a unit) File (Collection of similar records is called as File) Database (Collection of related data is referred as Database)

Functions / Operations that can be performed on files Create, Delete, Open , Close, Read, Write

8.2 File Management System Set of system software(part of OS) that provides services to users and applications in the use of files The file system is actually the interface between operating system and storage devices. When the user software, such as MS Word, asks to read a file from the hard disk, the operating system asks the file system to open the file:

Creating & formatting of a file system IBRI COLLEGE OF TECHNOLOGY

48

ITSE 1202

Introduction to Operating Systems

When a disk is formatted, it receives a file system .And it becomes organized and prepared to receive data. Formatting will remove all the information from the disk.

Note: OS cannot read data from a disk which uses an supported File System.

Functions of File system Identify and locate a selected file Use a directory to describe the location of all files and their attributes Allocate files to free blocks. Manage & organize the free storage. On shared system describe user access control

8.3 Directory / Folder In OS directory it self is a special file. It contains the information about the files in the directory. For each file in a directory, OS stores it file name file type and following information.

IBRI COLLEGE OF TECHNOLOGY

49

ITSE 1202 Table 8.1

Introduction to Operating Systems

8.4 Windows File System If user are installing a new hard disk, user need to partition and format it using a file system before user can begin storing data or programs. In Windows, the three file system options user have to choose from are NTFS, FAT32, and the older and rarely used FAT (also known as FAT16). NTFS NTFS is the preferred file system for this version of Windows. It has many benefits over the earlier FAT32 file system, including:

The capability to recover from some disk-related errors automatically, which FAT32 cannot. Improved support for larger hard disks. Better security because user can use permissions and encryption to restrict access to specific files to approved users.

FAT32 FAT32, and the lesser-used FAT, were used in earlier versions of Windows operating systems, including Windows 95, Windows 98, and Windows Millennium Edition. FAT32 does not have the security that NTFS provides, so if users have a FAT32 partition or volume on user computer, any user who has access to user computer can read any file on it. FAT32 also has size limitations. It cannot have partition greater than 32GB, and it cannot store a file larger than 4GB. The main reason to use FAT32 is to have a computer that will sometimes run Windows 98 or Windows ME and at other times run Windows XP, known as a multiboot configuration. Linux File system: ext2, ext3 (EXTENDED FILE SYSTEM) Max file size ax number of files Max filename size 16 TiB Set at filesystem creation Volume size

IBRI COLLEGE OF TECHNOLOGY

50

ITSE 1202 Max volume size Allowed characters 1024 PiB = 1 EiB All bytes except NUL and '/'

Introduction to Operating Systems

in filenames Dates recorded modification ,attribute modification, access date etc. Compression Encryption Table 8.2 1MB (megabyte) = 1024KB (kilobytes) 1GB (gigabyte) = 1024MB 1TB (terabyte) = 1024GB 1PB (petabyte) = 1024TB 1EB (exabyte) = 1024PB , Available

8.5 Partitioning: Disk partitioning is the act of taking the physical hard drive and creating logical partitions. For example, if user have a 5GB hard drive, user might partition it into two logical drives: a C: drive, which might be 2GB, and a D: drive, which might be 3GB.

IBRI COLLEGE OF TECHNOLOGY

51

ITSE 1202

Introduction to Operating Systems

Chapter -IX Windows Installation & Troubleshooting Installation Problems


9.1 Preparing to Install Windows XP Professional Before user begin the installation, user should know what is required for a successful installation and have all of the pieces of information userll need to supply during the installation process. In preparing for the installation, user should make sure that user know the hardware requirements for Windows XP Professional Check the Hardware Compatibility List (HCL) for Windows XP. Check that user computers BIOS is compatible with Windows XP Professional Check whether the devices in user computer have Windows XP drivers Understand the difference between a clean install and an upgrade Installation Options User will need to make many choices during the Windows XP Professional installation process. Following are some of the options that user will configure: How user hard disk space will be partitioned The file system user partitions will use Whether the computer will be a part of a workgroup or a domain. The language and locale for the computers settings

Installation Method User can install Windows XP Professional either from bootable CD or through a network Note Installation of Windows XP Professional is possible as an unattended process. It is called, Automating the Windows XP Installation. Installation Process

IBRI COLLEGE OF TECHNOLOGY

52

ITSE 1202

Introduction to Operating Systems

The steps in the following sections assume that the disk drive is clean and that user are starting the installation using the Windows XP Professional CD. There are four main steps in the Windows XP Professional installation process: Collecting information Hardware details will be collected Number of partitions, size, and file system information will be collected. Preparing the installation All the files required by the Setup program will be copied to the hard drive. Installing Windows Setup will gather information about user locale, computer name, and product key, Workgroup or Computer Domain. Finalizing the installation Specifying how the computer will connect to the Internet. Activating Windows Deciding whether user want to set up Internet access at the present time. Providing the name(s) of the user(s) who will use the computer. Dual-booting: Dual-booting or multi-booting allows user computer to boot multiple operating systems. Reason for dual-booting : It is to test various systems. If user have a limited number of computers in user test lab, and user want to be able to test multiple configurations, user dual-boot. It is for software backward compatibility. For example, user may have an application that works with Windows 98/2000 but not under Windows XP Professional. Here are some keys to successful dual-boot configurations: Make sure user have plenty of disk space. Each operating system on a separate partition is recommended. Put the simplest operating systems on first advanced OS next. (e.g Windows 98 then XP) If user will dual-boot with Windows NT, user must turn off disk compression or Windows XP will not be able to read the drive properly. 9.2 Automated Installation IBRI COLLEGE OF TECHNOLOGY

53

ITSE 1202

Introduction to Operating Systems

If user needs to install Windows XP Professional on multiple computers, automatic deployment will make user job easier and more cost effective. The three options for automated installation are Unattended installation In this method user use a distribution server to install Windows on a target computer. User can also use a Windows XP CD with an answer file on a floppy disk. The answer files can be used to provide installation instructions like additional language support, service packs, and device driver. Remote Installation Services (RIS) -It allows user to remotely install Windows which requires Windows 2000 Server The RIS server must have the RIS server software installed and configured. RIS clients are computers that have a Pre-boot execution Environment (PXE) network adapter. System Preparation Tool -This is used to create disk imaging or cloning. User can use disk images to install Windows on several computers that have the same configuration. To create a disk image, user install Windows on the source computer with the configuration, applications that user want to copy. After userve created the disk image, user can copy the image to destination computers through third-party software or through hardware disk duplication. PXE is a technology that is used to boot to the network when no operating system or has been installed on a client computer. Answer files are automated installation scripts used to answer the questions that appear during a normal Windowsinstallation

Table 8.1 9.3 Troubleshooting Installation Problems IBRI COLLEGE OF TECHNOLOGY 54

ITSE 1202

Introduction to Operating Systems

The Windows installation process is designed to be as simple as possible. The chances for installation errors are greatly minimized through the use of wizards and the step-by-step process. However, it is possible that errors may occur. Identifying Common Installation Problems As most of user is aware, installations seldom go off without a hitch. Following table lists some possible installation errors user might encounter.

Table 8.2 Troubleshooting Installation Errors with the Boot.ini File

IBRI COLLEGE OF TECHNOLOGY

55

ITSE 1202

Introduction to Operating Systems

If the text-based portion of the installation completes successfully, but the GUI-based portion of the installation fails, the error may be caused by a device driver that is failing to load properly. If user suspect that this is causing the installation error, user can edit a file called Boot.ini to list the drivers that are being loaded during the boot process. The Boot.ini file is located in the root of the system partition.

In order to cause the device drivers to be listed during the boot process, user need to edit the Boot.ini file to include the /sos switch, as shown: [Operating systems] multi(0)disk(0)rdisk(0)partition(1)\WINDOWS = "Microsoft Windows XP Professional" /sos

Installing Non-Supported Hard Drives If user computer is using a hard disk that does not have a driver included on the Windows CD, user will receive an error message stating that the hard drive cannot be found. User should verify that the hard drive is properly connected and functional. User will need to obtain a disk driver from the manufacturer for Windows XP and then specify that user are using a manufacturer-supplied driver (by pressing the F6 key when prompted) during the text-mode portion of the installation process.

Troubleshooting with Installation Log Files When user installs Windows XP Professional, the Setup program creates several log files. User can view these logs to check for any problems during the installation process. Two log files are particularly useful for troubleshooting: The action log includes all of the actions that were performed during the setup process and a description of each action. These actions are listed in chronological order. The action log is stored as \Windows\setupact.log.

The error log includes any errors that occurred during the installation. For each error, there is a description and an indication of the severity of the error. This error log is stored as \Windows\setuperr.log. If user cannot start Windows XP Professional, several options and utilities can be used to identify and resolve Windows errors. The following is a broad list of Troubleshooting options: If user have recently made a change to user computers configuration by installing a new device driver or application and Windows will not load properly, user can use the Last Known Good Configuration, roll back the driver, or use System Restore to restore a previous system configuration. IBRI COLLEGE OF TECHNOLOGY

56

ITSE 1202

Introduction to Operating Systems

If user can boot user computer to Safe Mode, and user suspect that user have a system conflict, user can temporarily disable an application or processes, troubleshoot services, or uninstall software. Use the Recovery Console to replace corrupted files or perform other recovery options manually. For example, user should verify that the BOOT.INI settings are correct. If necessary, user can use the Backup utility to restore operating and data files from Back up media. User can also use the Automated System Recovery Wizard in conjunction with the Backup utility to reformat the system partition and restore operating system files from backup media user previously created.

9.4 Windows utilities and options that can be used to assist in performing system recovery. Recovery Technique When to Use Event Viewer If the Windows can be loaded through Normal or Safe Mode, one of the first places to look for hints about the problem is Event Viewer. Event Viewer displays System, Security, and Application logs. Safe Mode This is generally user starting point for system recovery. Safe Mode loads the minimum of services and drivers that are needed to boot Windows. If user can load Safe Mode, user may be able to troubleshoot devices or services that keep Windows from loading normally. Last Known Good Configuration This option can help if user made changes to user computer and are now having problems. Last Known Good Configuration is an Advanced Options menu item that user can select during startup. It loads the configuration that was used the last time the computer booted successfully. This option will not help if user has hardware errors. Driver Rollback: It is used to restore a driver to a previous version that has been saved. This option is used when user updates a driver and it is not functioning properly. System Restore: It is used to create known checkpoints of user systems configuration. In the event that user system becomes misconfigured, user can restore the system configuration to one of the known good checkpoints. Backup: User should use this utility to safeguard user computer. Through the Backup utility, user can back up the system or parts of the system and restore data from backups that user have made. Use this if none of the above techniques is not helping. Recovery Console User can use this option if none of the other options or utilities works. The Recovery Console starts Windows without the graphical interface and allows the administrator limited capabilities, such as adding or replacing files and enabling/disabling services. IBRI COLLEGE OF TECHNOLOGY

57

ITSE 1202

Introduction to Operating Systems

9.5 Some terms on threats and security

Malware: Entities that cause malicious effect to software in general. Worms: A computer program which is self replicating in nature and which can spread itself across computers. Virus: A code that is written with the malicious intention of causing damage to the system Security: Refers to a set of measures taken to guard against theft, attack etc. Audit Log: A record of important events that occur in the computer system. Encryption: Process of coding of information in order to keep it secret. Decryption: Recovering the original message from encrypted data. Spyware is any technology, such as tracking software that aids in gathering information about a person or organization without their knowledge. Trojan horse, or simply trojan, is a piece of software which appears to perform a certain action but in fact performs another such as transmitting a computer virus.

Threats: Refers to an entity that posses hard challenge to the system, with a aim of damaging
system resources.

IBRI COLLEGE OF TECHNOLOGY

58

Vous aimerez peut-être aussi