Download Answer

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Library (computing) wikipedia , lookup

Security-focused operating system wikipedia , lookup

Plan 9 from Bell Labs wikipedia , lookup

Spring (operating system) wikipedia , lookup

RSTS/E wikipedia , lookup

DNIX wikipedia , lookup

Copland (operating system) wikipedia , lookup

Distributed operating system wikipedia , lookup

CP/M wikipedia , lookup

Unix security wikipedia , lookup

VS/9 wikipedia , lookup

Burroughs MCP wikipedia , lookup

Process management (computing) wikipedia , lookup

Transcript
Question 1:
What are the main components of operating systems?
Answer:
1- Process Management.
2- Main-Memory Management.
3- File Management.
4- I/O System Management.
5- Secondary-Storage Management.
6- Networking.
7- Protection System.
8- Command Interpreter System
Question 2:
What are the services provide by operating systems to programmers?
Answer:
1.Program Execution
The purpose of a computer systems is to allow the user to execute programs. So the operating
systems provides an environment where the user can conveniently run programs. The user
does not have to worry about the memory allocation or multitasking or anything.These things
are taken care of by the operating systems. Running a program involves the allocating and
deallocating memory, CPU scheduling in case of multiprocess. These functions cannot be
given to the user-level programs. So user-level programs cannot help the user to run
programs independently without the help from operating systems.
2.I/O Operations
Each program requires an input and produces output. This involves the use of I/O. The
operating systems hides the user the details of underlying hardware for the I/O. All the user
sees is that the I/O has been performed without any details. So the operating systems by
providing I/O makes it convenient for the users to run programs. For efficiency and
protection users cannot control I/O so this service cannot be provided by user-level programs.
3.File System Manipulation
The output of a program may need to be written into new files or input taken from some files.
The operating systems provides this service. The user does not have to worry about
secondary storage management. User gives a command for reading or writing to a file and
sees his her task accomplished. Thus operating systems makes it easier for user programs to
accomplished their task. This service involves secondary storage management. The speed of
I/O that depends on secondary storage management is critical to the speed of many programs
and hence I think it is best relegated to the operating systems to manage it than giving
individual users the control of it. It is not difficult for the user-level programs to provide these
services but for above mentioned reasons it is best if this service s left with operating system.
4.Communications
There are instances where processes need to communicate with each other to exchange
information. It may be between processes running on the same computer or running on the
different computers. By providing this service the operating system relieves the user of the
worry of passing messages between processes. In case where the messages need to be passed
to processes on the other computers through a network it can be done by the user programs.
The user program may be customized to the specifics of the hardware through which the
message transits and provides the service interface to the operating system.
5. Error Detection
An error is one part of the system may cause malfunctioning of the complete system. To
avoid such a situation the operating system constantly monitors the system for detecting the
errors. This relieves the user of the worry of errors propagating to various part of the system
and causing malfunctioning. This service cannot allowed to be handled by user programs
because it involves monitoring and in cases altering area of memory or deallocation of
memory for a faulty process.
Or may be relinquishing the CPU of a process that goes into an infinite loop. These tasks are
too critical to be handed over to the user programs. A user program if given these privileges
can interfere with the correct (normal) operation of the operating systems.
Question 3:
Give a brief explanation of the following operating systems keywords:
Operating System, Share Time, Parallel system, Distributed system, Kernel,
process, deadlock, Long Term Scheduling, Short term scheduling, PCB.
Answer:
Operating system:
- Is the set of software that controls the overall operation of a computer system.
-Is a program modules within a computer system that govern the control of equipment
resources such as , Processor, Main Memory, Secondary Storage, I/O devices and
Files. These modules resolve conflicts attempt to optimize performance and simplify the
effective use of the system .
-Is an interface between the user program and physical computer hardware.
Share Time:
Is sharing a computing resource among many users by means of multiprogramming and multitasking. allowing a large number of users to interact concurrently with a single computer.
Time sharing system supports interactive users.timesharing is also called Multitasking.IT is
logical extension of multiprogramming time sharing system Uses CPU scheduling and
multiprogramming to provide economical interactive system of two or more users.
In time sharing , each user is given a time-slice for executing his job in round-robin fashion.
job continous until the time-slice ends.time sharing systems are more complex than
multiprogramming operating system.
- OS assigns some time slots to each job. Here, each job is executed according to the
allocated time slots for example:
Job1: 0 to 5
Job2: 5 to 10
Job3: 10 to 15
Parallel system:
Parallel operating systems are used to interface multiple networked computers to complete tasks in
parallel.
Distributed system:
This system distributes computation among several physical processors. The
processors do not share memory or a clock. Instead, each processor has its own local
memory. They communicate with each other through various communication lines, such as a
high-speed bus or local area network.
Kernel:
-The kernel is a program that constitutes the central core of a computer operating system. It has
complete control over everything that occurs in the system.
-The kernel is the first part of the operating system to load into memory during booting (i.e., system
startup), and it remains there for the entire duration of the computer session because its services
are required continuously. Thus it is important for it to be as small as possible while still providing all
the essential services needed by the other parts of the operating system and by the various
application programs.
-The kernel provides basic services for all other parts of the operating system, typically including
memory management, process management, file management and I/O (input/output) management
(i.e., accessing the peripheral devices). These services are requested by other parts of the operating
system or by application programs through a specified set of program interfaces referred to as
system calls.
Process:
-A computer program is a passive collection of instructions; a process is the actual execution of those
instructions. Several processes may be associated with the same program; for example, opening up
several instances of the same program often means more than one process is being executed.
Deadlock:
-Is a situation in which two or more competing actions are each waiting for the other to finish.
-Is a set of processes is deadlocked if each process in the set is waiting for an event that only another
process in the set can cause (including itself).
-In an operating system, a deadlock is a situation which occurs when a process enters a waiting state
because a resource requested by it is being held by another waiting process, which in turn is waiting
for another resource. If a process is unable to change its state indefinitely because the resources
requested by it are being used by another waiting process, then the system is said to be in a
deadlock.
Long Term Scheduling:
Determines which jobs to admit to the system. Upon admission, these jobs become
processes or groups of processes.
Short term scheduling:
Determines which ready process gets the CPU next.
PCB:
- PCB is the Area in memory where the OS can find all the information it needs to know about a
process ,means PCB hold the information of all processes and keep track of all the processes. A
process control block or PCB is a data structure (a table) that holds information about a process.
Every process or program that runs needs a PCB. When a user requests to run a particular program,
the operating system constructs a process control block for that program
-The PCB is a certain store that allows the operating systems to locate key information about a
process. Thus, the PCB is the data structure(a table) that defines a process to the operating systems.
The PCB contains important information about the specific process including:-

Process State - Running, waiting, etc., as discussed above.


Process ID, and parent process ID.
CPU registers and Program Counter - These need to be saved and restored when
swapping processes in and out of the CPU.
CPU-Scheduling information - Such as priority information and pointers to
scheduling queues.
Memory-Management information - E.g. page tables or segment tables.
Accounting information - user and kernel CPU time consumed, account numbers,
limits, etc.
I/O Status information - Devices allocated, open file tables, etc.




Question 4:
Consider the following set of processes, with their arrival times and the length of the CPUservice time, given in milliseconds:
Process Name
Arrival Time (ms)
Service Time (ms)
A
0
5
B
4
8
C
5
3
D
6
5
E
8
2
Draw four Gantt charts illustrating the execution of these processes using: FCFS, SJF,
RR (quantum =2 ms), and RR (quantum =6 ms) scheduling techniques and compute the
average waiting time (AWT).
Answer:
FCFS:
A
B
0
C
5
D
13
E
16
21
23
Waiting Time (WT):
A= 0-0 = 0 ms
B= 5 -4 = 1 ms
C= 13 -5 = 8 ms
D= 16 – 6 = 10 ms
E= 21 – 8 = 13 ms
Average waiting time (AWT)=
0+1+8+10+13
=6.4 ms
5
SJF:
A
0
C
5
E
8
D
10
B
15
23
Waiting Time (WT):
A= 0 -0 = 0 ms
B= 15 – 4 = 11 ms
C= 5 – 5= 0 ms
D= 10 – 6 = 4 ms
E= 8 – 8 = 0 ms
Average Waiting Time ( AWT )=
0+11+0+4+0
5
=
3 ms
RR ( quantum = 2 ms):
A
0
A
2
B
4
C
6
D
8
E
A
B
C
D
B
10 12 13 15 16 18
D
B
20 21
23
Waiting Time:
A= 12 – 4 – 0 = 8 ms
B= 21 – 6 – 4=11 ms
C=15 – 2 – 5 = 8 ms
D= 20 – 4 – 6 = 14 ms
E= 10 – 8 = 2 ms
Average waiting Time ( AWT)=
𝟖+𝟏𝟏+𝟖+𝟏𝟒+𝟐
= 8.6ms
𝟓
RR ( Quantum = 6 ms ):
A
0
B
5
C
D
11
14
19
Waiting Time:
A = 0 – 0 = 0 ms
B= 21 – 6 – 4 = 11 ms
C= 11 – 5 = 6 ms
D= 14 – 6 = 8 ms
E= 19 – 8 = 11 ms
Average Waiting Time (AWT)=
𝟎+𝟏𝟏+𝟔+𝟖+𝟏𝟏
𝟓
E
= 7.2ms
minimum average waiting time = 3 ms in( SJF)
B
21
23
Question 5:
When the processes leaf the processor. draw the queue diagram, explain who
the process transfer among the different queues in the system
Answer:
There are many reasons for process termination:



















Batch job issues halt instruction
User logs off
Process executes a service request to terminate
Error and fault conditions
Normal completion
Time limit exceeded
Memory unavailable
Bounds violation; for example: attempted access of (non-existent) 11th element of a
10-element array
Protection error; for example: attempted write to read-only file
Arithmetic error; for example: attempted division by zero
Time overrun; for example: process waited longer than a specified maximum for an
event
I/O failure
Invalid instruction; for example: when a process tries to execute data (text)
Privileged instruction
Data misuse
Operating system intervention; for example: to resolve a deadlock
Parent terminates so child processes terminate (cascading termination)
Parent request
fatal error
Question 6:
what is the process control block (PCB), and who it is use in switching time.
Answer:
PCB is the Area in memory where the OS can find all the information it needs to know about a
process ,means PCB hold the information of all processes and keep track of all the processes. A
process control block or PCB is a data structure (a table) that holds information about a process.
Every process or program that runs needs a PCB. When a user requests to run a particular program,
the operating system constructs a process control block for that program
Question 7:
Draw a process state diagram, and explain different process state.
Answer:
complete
Exit(kill
)
dispatching
new
submit
hold
running
waiting for
admit
ready
admit
run time out
i/o event
i/o event terminated
Waiting
enter
suspended
activate
suspended
suspended
ready
(blocked)
suspended
activate
i/o event completed
suspended
Complete state transition diagram
blocked
Processes may be in one of 5 states, as shown in diagram above:





New - The process is in the stage of being created.
Ready - The process has all the resources available that it needs to run, but the CPU is
not currently working on this process's instructions.
Running - The CPU is working on this process's instructions.
Waiting - The process cannot run at the moment, because it is waiting for some
resource to become available or for some event to occur. For example the process
may be waiting for keyboard input, disk access request, inter-process messages, a
timer to go off, or a child process to finish.
Terminated - The process has completed.
Question 8:
What are the deadlock necessary conditions ?
Answer:
 Mutual exclusion: resources cannot be shared.
 Hold and wait: processes request resources incrementally, and hold on to what they've
got.
 No pre-emption: resources cannot be forcibly taken from processes.
 Circular wait: circular chain of waiting, in which each process is waiting for a resource
held by the next process in the chain