Operating System
Operating System
Operating System
o File creation/deletion.
o Support for hierarchical file systems
o Update/retrieval operations: read, write, append, seek
o Mapping of files to secondary storage
4. Protection
Controlling access to the system
o Resources --- CPU cycles, memory, files, devices
o Users --- authentication, communication
o Mechanisms, not policies
5. Network Management
Often built on top of file system
o TCP/IP, IPX, IPng
o Connection/Routing strategies
o ``Circuit'' management --- circuit, message, packet switching
o Communication mechanism
o Data/Process migration
6. Network Services (Distributed Computing)
Built on top of networking
o Email, messaging (GroupWise)
o FTP
o gopher, www
There are Many Operating Systems those have be Developed for Performing the
Operations those are requested by the user. There are Many Operating Systems which
have the Capability to Perform the Requests those are received from the System. The
Operating system can perform a Single Operation and also Multiple Operations at a
Time. So there are many types of Operating systems those are organized by using their
Working Techniques.
1) Serial Processing: The Serial Processing Operating Systems are those which
Performs all the instructions into a Sequence Manner or the Instructions those are
given by the user will be executed by using the FIFO Manner means First in First
Out. All the Instructions those are Entered First in the System will be Executed First and
the Instructions those are Entered Later Will be Executed Later. For Running the
Instructions the Program Counter is used which is used for Executing all
the Instructions.
In this the Program Counter will determines which instruction is going to Execute and
the which instruction will be Execute after this. Mainly thePunch Cards are used for
this. In this all the Jobs are firstly Prepared and Stored on the Card and after that
card will be entered in the System and after that all the Instructions will be executed one
by One. But the Main Problem is that a user doesnt interact with the
System while he is working on the System, means the user cant be able to enter the
data for Execution.
2) Batch Processing: The Batch Processing is same as the Serial Processing
Technique. But in the Batch Processing Similar Types of jobs are Firstly
Prepared and they are Stored on the Card. and that card will be Submit to the System
for the Processing. The System then Perform all the Operations on the Instructions one
by one. And a user cant be Able to specify any input. And Operating System wills
increments his Program Counter for Executing the Next Instruction.
The Main Problem is that the Jobs those are prepared for Execution must be
the Same Type and if a job requires for any type of Input then this will not be Possible
for the user. And Many Time will be wasted for Preparing the Batch. The Batch Contains
the Jobs and all those jobs will be executed without the user Intervention.
And Operating System will use the LOAD and RUN Operation. This will first
LOAD the Job from the Card and after that he will execute the instructions.
By using the RUN Command.
The Speed of the Processing the Job will be Depend on the Jobs and the Results those
are produced by the System in difference of Time which is used for giving or submit the
Job and the Time which is used for Displaying the Results on the Screen.
3) Multi-Programming: As we know that in the Batch Processing System there are
multiple jobs Execute by the System. The System first prepare a batch and after that he
will Execute all the jobs those are Stored into the Batch. But the Main Problem is that if
a process or job requires an Input and Output Operation, then it is not possible and
second there will be the wastage of the Time when we are preparing the batch and
the CPU will remain idle at that Time.
But With the help of Multi programming we can Execute Multiple Programs on
the System at a Time and in the Multi-programming the CPU will never get idle,
because with the help of Multi-Programming we can Execute Many Programs on the
System and When we are Working with the Program then we can also Submit the
Second or Another Program for Running and the CPU will then Execute the Second
Program after the completion of the First Program. And in this we can also specify our
Input means a user can also interact with the System.
The Multi-programming Operating Systems never use any cards because the Process is
entered on the Spot by the user. But the Operating System also uses the Process
of Allocation and De-allocation of the Memory Means he will provide the
Memory Space to all the Running and all the Waiting Processes. There must be the
Proper Management of all the Running Jobs.
4) Real Time System: There is also an Operating System which is known as Real Time
Processing System. In this Response Time is already fixed. Means time to Display the
Results after Possessing has fixed by the Processor or CPU. Real Time System is used at
those Places in which we Requires higher and Timely Response. These Types of
Systems are used in Reservation. So when we specify the Request, the CPU will perform
at that Time. There are two Types of Real Time System
1) Hard Real Time System: In the Hard Real Time System, Time is fixed and we
cant Change any Moments of the Time of Processing. Means CPU will Process the data
as we Enters the Data.
2) Soft Real Time System: In the Soft Real Time System, some Moments can be
Change. Means after giving the Command to the CPU, CPU Performs the Operation
after a Microsecond.
5) Distributed Operating System. - Distributed Means Data is Stored and Processed
on Multiple Locations. When a Data is stored on to the Multiple Computers, those are
placed in Different Locations. Distributed means In the Network, Network Collections of
Computers are connected with Each other.
Then if we want to Take Some Data From other Computer, Then we uses the Distributed
Processing System. And we can also Insert and Remove the Data from out Location to
another Location. In this Data is shared between many users. And we can also Access all
the Input and Output Devices are also accessed by Multiple Users.
6) Multiprocessing: Generally a Computer has a Single Processor means a Computer
have a just one CPU for Processing the instructions. But if we are Running multiple jobs,
then this will decrease the Speed of CPU. For Increasing the Speed of Processing then
we uses the Multiprocessing, in the Multi Processing there are two or More CPU in a
Single Operating System if one CPU will fail, then other CPU is used for providing
backup to the first CPU. With the help of Multi-processing, we can Execute Many Jobs
at a Time. All the Operations are divided into the Number of CPUs. if first CPU
Completed his Work before the Second CPU, then the Work of Second CPU will be
divided into the First and Second.
When a user Request for a Service from the System, then the System Automatically
initializes the Process by using the initial State and the System also provides the various
types of input and output Resources to the Process, Provides also Some Memory and
also Control the Execution and Also Controls the State of the Process. So that in the
Execution of Process, we doesnt implement only the Process creation but we also use
the various Controlling Mechanism for the Process.
There are Many Types of Operating Systems which executed the Process either Single
or Multiple Processes are executed at a Single time. And For Executing the
Multiple Processes we must have to use Some Controlling Mechanisms.
Process Scheduling
As we know that we can perform many Programs at a Tim e on the Computer. But there
is a Single CPU. So for running all the Programs concurrently or simultaneously. Then
we use the Scheduling. Processes are the Small Programs those are executed by the user
according to their Request. CPU Executes all the Process according to Some Rules or
Some Schedule. Scheduling ist hat in which each process have Some Amount of Time of
CPU. Scheduling Provides Time of CPU to the Each Process.
There are Two Types of Scheduling
1) Preemptive: In this all the Processes are executed by using some Amount of Time
of CPU. The Time of CPU is divided into the Number of Minutes and Time of CPU
divided into the Process by using Some Rules. if the time is divided into equal interval
than it is called Quantum Time. in the Preemptive Scheduling
Jobs are Executed one by one according to the Scheduling Techniques, But in this when
the Higher Priority will Request for a Service. To the CPU, then CPU will transfer the
Control to the Request Job, Means the Running job will wait for Some Time.
2) NON-Primitive: In this No Time Scheduling is used and in this CPU will be
automatically free after Executing the Whole Process Means When the Execution of the
Process will Completed then the CPU will be Free. When two or more Process are given
then this will first Complete the Process and after Completing the First Process, this will
Automatically start the Second Process.
Non-Preemptive Scheduling means No scheduling then all the Jobs are
Executed One by One. And in this when the First Job will be Completed, after that
second Job will Started.
Preemptive Scheduling: We have various Techniques of Scheduling.
1) First Come First Serve: As the name Suggest, the Processes those are Coming
first, will be Executed first and Means CPU Will Creates a Queue, means all the Process
are Inserted into the Queue and the CPU will Perform all the Process by using their
Coming Order.. In this all the Process are arranged by the CPU and After Executing a
Single Process, then this will Automatically Execute second Process by Picking up the
next Process.
2) Shortest Job first: In this Scheduling, All the Process are Arranged into their Size
Means How Many Time a Process require, of CPU for Executing. CPU Arrange all the
Processes according to the Requirement Time. CPU Executes the Processes by
Examining the Time Required by Process. CPU Prepare a queue in which all the
Processes are arranged by using the Number of Time Units Requires by the Process.
For Example if we want to Print a Page and move a Mouse on the Screen. So that CPU
will first Move the Mouse on the Screen. Then after that he will print a Page. Because
Job of printing Require a Lots of Time and Moving a Mouse is just requires little Time of
CPU.
3) Priority Scheduling: When the Process are Given, then Each Process have a
Priority means Some Preference issue. Which Job will be executed first, is determined
by the CPU. After Examining the Priority of the CPU. Each Process takes different Time
of CPU and also the Number of Inputs those are needed by the CPU. So CPU Maintains
the Priority Level after Examining the Total time which a Process will consume. All the
Processes are Arranged by using Some Priority,. Then CPU Executes the Process by
using the Process Priority.
4) Round Robin: In this Scheduling the Time of CPU is divided into the Equal Parts
and Assign to various Processes. In this Time of CPU is also known as Quantum Time.
In the Round Robin, when the time of First Process has finished, then the CPU will
execute the Second Process. But there also be possibility that the Process doesnt End,
up to The Time. So that if process doesnt end at the End of Time. Then CPU uses the
Context Switching, Means CPU Record the State of Process. After executing the other
Processes, he will execute the First Process Again until the Process never ends.
5) Multilevel Queue Scheduling: In this The Time of CPU is divided by using Some
Process Categories. In this the Process those are executed on the Foreground or on the
Screen, have a higher Priority and the Process those are running in the Background to
fill the Request the user. When we Input the data into the Computer. Then the Data is
displayed on the Screen after Processing.
Threads share the address space of the process that created it; processes have their
own address space.
2.
Threads have direct access to the data segment of its process; processes have their
own copy of the data segment of the parent process.
3.
Threads can directly communicate with other threads of its process; processes must
use interprocess communication to communicate with sibling processes.
4.
5.
New threads are easily created; new processes require duplication of the parent
process.
6.
Threads can exercise considerable control over threads of the same process;
processes can only exercise control over child processes.
7.
Changes to the main thread (cancellation, priority change, etc.) may affect the
behavior of the other threads of the process; changes to the parent process do not
affect child processes.
Types of Threads
There are two types of threads to be managed in a modern system: User threads
and kernel threads.
User threads are supported above the kernel, without kernel support. These are
the threads that application programmers would put into their programs.
Kernel threads are supported within the kernel of the OS itself. All modern
OSes support kernel level threads, allowing the kernel to perform multiple
simultaneous tasks and/or to service multiple kernel system calls
simultaneously.
In a specific implementation, the user threads must be mapped to kernel
threads, using one of the following strategies.
Process Synchronization
Process Synchronization means sharing system resources by processes in a such a way that,
Concurrent access to shared data is handled thereby minimizing the chance of inconsistent data.
Maintaining data consistency demands mechanisms to ensure synchronized execution of
cooperating processes.
Process Synchronization was introduced to handle problems that arose while multiple process
executions.
Mutual exclusion by Test and Set Lock (TSL) instruction: TSL instruction is used for reading
from a location or writing to a location in the memory and then saving a non zero value at an
address in memory. It is implemented in the hardware and is used in a system with multiple
processors. When one processor is accessing the memory, no other processor can access the
same memory location until TSL instruction is finished. Locking of the memory bus in this way is
done in the hardware.
- By implementing the spin locks correctly as they offer challenges as the programmers
must take into account the possibility of simultaneous access to the lock, which could cause
race conditions.
Semaphores
Dead-Lock
Resource of System for example two or more users Request for the Printers at a Same
Time and When Dead-Lock has occurred.
All the users will be on Wait State Means, No user can get the resource of the System. Or
Dead-Lock is occurred when two or More Requests are waiting for Some Operation
Which is not possible. There is also Some Situation When the Problem of Dead Lock has
occurred. There are Following Conditions
1) Circular Wait:- When two or More Requests are Waiting For a Long Period of
Time and no one can Access the Resource from the System Resources , Then this is
called as Circular Wait For Example if two or more users Request for a Printer, at a
Same Time , they Request to Print a Page. Then they will be on the Circular Wait. Means
System Will Display Busy Sign of Sign.
2) Partial Allocation: - After Processing the Request, if a user doesnt leave the
Resource of the System, then we cant use the Resource of the System. Then in this
Situation when the other users, Request for the Resource then the other users, will also
be on the Waiting State. Then this will create the Deadlock.
3) Mutual Exclusive:- When a Single Process is used by two or more Processes,
Means a Single Resource if used for performing the two or more activities as a Shared
Based. But this is will Also Create a Problem because when a Second user Request for
the System Resource which is being used by the user.
4) HOLD and Wait:- A Single Process may need two or more System Resources.
And suppose if a Process have a Single Resource, and he is waiting the Second Resource.
Then Process cant Leave the first Resource and waiting for the Second Resource. So
that there will also be the Condition of Deadlock.
5) No Preemption:- if there is no Rule to use the System Resources. Means if all the
System Resources are not allocated in the Manner of Scheduling. Then this will also
create a Problem for a Deadlock because there is no surety that a Process will Release
the System Resources after the Completion. So Preemption and Transaction
Rollback prevents Deadlock situation.
For Avoiding a Dead Lock First of all we have to detect Dead-Lock Means
Firstly we have to detect why and how a Deadlock has occurred and Then Avoid or Solve
the Problems those are Occurred due to Occurrence of Deadlock.
Deadlocks
References:
Current
Allocation
P0
10
P1
P2
Figure 7.9 - (a) Resource allocation graph. (b) Corresponding wait-for graph