Operating Systems Services: Program Execution
Operating Systems Services: Program Execution
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 efficiently and protection users cannot control I/O so this service
cannot be provided by user-level programs.
Process Control
2.
File Management
3.
Device Management
4.
Information Maintenance
5.
Communication
1. Process Control
1.
end, abort.
2.
load, execute.
3.
4.
5.
6.
7.
2. File Management
1. create file, delete file.
2. open, close.
3. read, write, reposition.
4. get file attributes, set file attributes.
3. Device Management
1. request device, release device.
2. read, write, reposition.
3. get device attributes, set device attributes.
4. logically attach or detach devices.
4. Information Maintenance
1. get time or date, set time or date.
2. get system data, set system data.
3. get process, file, or device attributes.
4. set process, file, or device attributes.
5. Communications
1. create, delete communication connection.
2. send, receive messages.
3. transfer status information.
4. attach or detach remote devices.
What is Thread?
A thread is a flow of execution through the process code, with its own
program counter, system registers and stack. A thread is also called a light
weight process. Threads provide a way to improve application performance
through parallelism. Threads represent a software approach to improving
performance of operating system by reducing the overhead thread is
equivalent to a classical process.
Each thread belongs to exactly one process and no thread can exist outside
a process. Each thread represents a separate flow of control.Threads have
been successfully used in implementing network servers and web server.
They also provide a suitable foundation for parallel execution of applications
on shared memory multiprocessors. Folowing figure shows the working of
the single and multithreaded processes.
Process
Thread
Advantages of Thread
Efficient communication.
Types of Thread
Threads are implemented in following two ways
Advantages
Disadvantages
Advantages
Kernel can simultaneously schedule multiple threads from the same process on
multiple processes.
If one thread in a process is blocked, the Kernel can schedule another thread of
the same process.
Disadvantages
Kernel threads are generally slower to create and manage than the user threads.
Transfer of control from one thread to another within same process requires a
mode switch to the Kernel.
Multithreading Models
Some operating system provide a combined user level thread and Kernel
level thread facility. Solaris is a good example of this combined approach. In
a combined system, multiple threads within the same application can run in
parallel on multiple processors and a blocking system call need not block
the entire process. Multithreading models are three types
Implementation is by a thread
library at the user level.