PCB Process Control Block
PCB Process Control Block
counter/registers/memory limits/list of open files/ Six Process states Linux OS: Ready to be executed soon as kernel schedule it. Executing executed in the CPU Interruptable blocked state, process is waiting, w8 for resource, or signal from another process. Uninterruptable: blocked state. Waiting directly on hardware conditions and will not accept signals. Stopped: has been halted, and resume by positive action from another process. Zombie: terminated but, still must have its task structure in process table Process Scheduling Queues Job queue all processes in system Ready queue all processes residing in main memory, ready and waiting to execute Device queues processes waiting for an I/O device Schedulers Long-term (job) selects which processes should be brought into ready queue Short-term(CPU) selects which process should be executed next and allocates CPU Busy waiting process checks to see if condition is true, waiting for a lock to become available. Disabling interrupts prevents processes from running and their critical sections. RPC Remote procedure call, allows program on computer to execute program server. Binary semaphores can have two values, represent that process/thread in critical section. Counting semaphores take more than two values. Max value X they take allows X process/threads to access shared resource simultaneously. User threads supported kernel, without kernel support. Threads that application programmers would put into their programs. Kernel threads supported within kernel of OS itself. OSs support kernel threads, allowing kernel to perform multiple simultaneous tasks. Network Information Service/NIS clientserver service protocol for distributing system configuration data Ex, user and host names between computers on computer network. Makefile syntax/makefilename//targets//predefined stuff//variables Network File System, allows all network users to access shared files stored on computers of different types. Readers-writer lock is a data structure that solves one or more of the readers-writers problems. Spin lock is used to stop the process from re-scheduling or prevent context switching. Critical section problem two processes shares code and if one updates code while other reading it, there occurs a conflict. To avoid create lock that block no new process can access until first process release it.
Threads, lightweight process (LWP), thread is basic unit of CPU utilisation Thread ID/Program counter/Register set/Stack It shares with other threads belonging to same process, its code section, data section and other OS resources, such as open files and signals Multi-threaded process has multiple threads of control, it means can do more than one task at time. Responsiveness allow program to continue running even if part of it is blocked. Resource Sharing share the memory & resources of the process to which they belong. Economy because share resources. creation time30x thread, switch time 5xthread If thread performs blocking system call, kernel can schedule another thread In multi-processor systems, kernel can schedule threads on different processors Multithreading models. Many-to-One Many user-level threads mapped to single kernel thread Since only one thread can access the kernel at a time. One process can blocking system call One-to-One multiple threads to run in parallel on multiprocessors Allowing another thread to run when thread makes blocking system call Many-to-Many many user level threads to mapped to as many or smaller number of kernel threads. Two level similar to M:M, except that it allows a user thread to be bound to kernel thread Thread cancellation is the task of terminating a thread before it has completed Thread to be cancelled is called a target thread
Asynchronous cancellation thread immediately terminates target thread Deferred cancellation target thread can periodically check if it should terminate, allowing thread terminate itself. Signal handler is used to process signals is generated by event, delivered process or handled Deliver signal to thread which the signal applies Synchronously delivered to the same process that performed the operation causing the Asynchronously delivered generated by an event external to a running process Every signal may be handled by one of two possible handlers: Default signal handler: run by the kernel when handling the signal User-defined signal handler: user-defined function which over-rides default signal handler Scheduler Activations Both M:M//Two-level models require communication to number of kernel threads allocated to application Scheduler activations provide upcalls communication mechanism from kernel to thread library Race condition multiple proces read/write shared data and final result depends on their execution fork()create new processes. exec() system call call wait() determine when child process has completed it's job and finished Zombie(), Using fork() to create child processes it is important to keep track of these processes
Monitor set of multiple routines which are protected by a mutual exclusion lock. Only ONE thread can execute within the monitor at a time. Semaphore lock thread protects shared resource and must acquire lock before using shared resource protected bysemaphore. Mutex short for mutual exclusion. Only one thread can use the shared resource at a time. Monitors and Semaphores are used for thread synchronization. Monitors are simpler to use than semaphores because they handle all of details of lock acquisition and release. Application using semaphores has to release any locks thread has acquired when application terminates this must be done by application itself. Thread pool allocated from the pool as needed, and returned to the pool when no longer needed.
Linux OS Kernel//System Library//System Utility Portable// Open Source Portability means software can works on different types of hardware in same way. Multi-User multiple users can access system resources Multiprogramming means multiple applications can run at same time. Hierarchical File System standard file structure in which system files/ user files are arranged. Raid 0 Blocks Striped No Mirror No parity Performance, no redundancy (ACE)(BDF) Raid 1, Mirrored, No stripe, No parity Performance, excellent redundancy (mirrored) (ABC)(ABC) RAID 5 Blocks striped, Distributed Parity (AC3)(BEp2)(DFp1) Prformance, redundancy, providing best for both Raid10 2x(ACE) 2x(BDF)Mirrored and striped