Escolar Documentos
Profissional Documentos
Cultura Documentos
What is an os?
• Programs with special privileges on the hardware that let them run and
manage other programs.
• First program to run when a computer is turned on.
• All subsequent programs are started by the OS.
• Started in 1950s.
• First they were made to manage the manual task of loading programs by
hand.
• Batch programming began.
- When one task ended, next was in line automatically. There was
no need for humans to run after bring the next code.
• When systems were less costly, software sharing began.
• So hardware interfacing became a problem. This became a tough task
for programmers.
• So OS began to act as an interface between software and hardware
peripherals – device drivers.
A human running around putting programs into readers was a very slow process.
Life without OS
The users write code that tells computers what exactly to do.
1. UNIX source code is not easily available. Linux source code open source.
2. UNIX is not portable, whereas Linux is.
3. Linux can be installed on home based PCs. UNIX installation is comparatively
tricky.
4. Unix is used in server systems, high end computers.
Semaphore
Mutex
** semaphore vs mutex
- At any point of time, only one thread can work with the entire buffer. The
concept can be generalized using semaphore.
- A semaphore is a generalized mutex.
- In lieu of single buffer, we can split the 4 KB buffer into four 1 KB buffers
(identical resources).
- A semaphore can be associated with these four buffers. The consumer and
producer can work on different buffers at the same time.
- Web service receives http requests for data, places request on a queue. Worker
thread pulls the work item from queue and performs the work.
- Printing of documents
Process
Thread
Why thread
** Any program which does more than one task at a time should use thread
** Any sequential task that cannot be made parallel does not need threads.
Deadlock
• A situation where 2 or more processes wait for each other to finish but none of
them ever finishes.
• When 2 processes hold some resource and wait for resource held by other
1. 4 conditions – mutual exclusion – resource cannot be shared.
2. Hold and wait – process holding one resource and waiting for some other
resource
3. No preemption
4. Circular wait
Virtual Memory
Thrashing
When system spends more time processing page faults than executing transactions
Belady anomaly
When increasing number of page frames result in increase in number of page faults