os202

OS202

View on GitHub

HOME


Top 10 List of Week 06

  1. Process
    A process is a program in execution. Process is not the same as program. A process is an active entity as opposed to program which is considered to be a passive entity. When a program is loaded into the memory and it becomes a process, it can be divided into four sections stack, heap, text and data. Process

  2. Process State
    Processes in the operating system can be in any of the following states:
    • NEW: The process is being created.
    • READY: The process is waiting to be assigned to a processor.
    • RUNNING: Instructions are being executed.
    • WAITING: The process is waiting for some event to occur(such as an I/O completion or reception of a signal).
    • TERMINATED: The process has finished execution. Process State
  3. Process Control Block
    A Process Control Block is a data structure maintained by the Operating System for every process. The PCB is identified by an integer process ID (PID)
    • Process State - Running, waiting, etc.
    • 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.
  4. Process Scheduling
    The process scheduling is the activity of the process manager that handles the removal of the running process from the CPU and the selection of another process on the basis of a particular strategy. This allow more than one process to be loaded into the executable memory at a time and the loaded process shares the CPU using time multiplexing.

  5. Inter-Process Communication
    Interprocess communication is the mechanism provided by the operating system that allows processes to communicate with each other. This communication could involve a process letting another process know that some event has occurred or the transferring of data from one process to another.

  6. Thread
    A thread is a path of execution within a process. A process can contain multiple threads. The idea is to achieve parallelism by dividing a process into multiple threads. For example, in a browser, multiple tabs can be different threads. MS Word uses multiple threads: one thread to format the text, another thread to process inputs, etc.

  7. Difference between Process and Thread
    • Process is heavy weight, while thread taking lesser resources than a process
    • Process switching needs interaction with operating system, while Thread switching does not need to interact with operating system.
    • In multiple processing environments, each process executes the same code but has its own memory and file resources, while All threads can share same set of open files, child processes.
    • If one process is blocked, then no other process can execute until the first process is unblocked, while one thread is blocked and waiting, a second thread in the same task can run
  8. Multithreading Model
    • Many to Many Model
      This model will multiplex user threads to same or lesser number of kernel level threads. Number of kernel level threads are specific to the machine, advantage of this model is if a user thread is blocked we can schedule others user thread to other kernel thread. Thus, System doesnt block if a particular thread is blocked.
    • Many to One Model
      This model will have map multiple user threads to one kernel thread. In this model when a user thread makes a blocking system call entire process blocks. As we have only one kernel thread and only one user thread can access kernel at a time, so multiple threads are not able access multiprocessor at the same time.
    • One to One Model
      In this model, one to one relationship between kernel and user thread. In this model multiple thread can run on multiple processor. Problem with this model is that creating a user thread requires the corresponding kernel thread.
  9. Thread Libraries
    Thread libraries provide programmers with an API for creating and managing threads. Thread libraries may be implemented either in user space or in kernel space. The former involves API functions implemented solely within user space, with no kernel support. The latter involves system calls, and requires a kernel with thread library support. There are three main thread libraries in use today:
    • POSIX Pthreads
    • Win32 threads
    • Java threads
  10. Concurrency
    Concurrency is the execution of the multiple instruction at the same time. It happens when there are several process threads running in parallel. The running process threads always communicate with each other through shared memory or message passing.