2nd Trinal

1.The Concept of Process




  • An operating system executes a variety of programs:


  1. Batch system – jobs

  2. Time-shared systems – user programs or tasks .


  • Textbook uses the terms job and process almost interchangeably.


  • Process – a program in execution; process execution must progress in sequential fashion.


  • A process includes:



  1. program counter - is a processor register that indicates where the computer is in its instruction sequence. Depending on the details of the particular computer, the program counter holds either the address of the instruction being executed, or the address of the next instruction to be executed.

  2. stack -abstract data type and data structure based on the principle of Last In First Out (LIFO)

  3. data section -This low-level code is used, among other things, to initialize and test the system hardware prior to booting the OS


a)Process State- As a process executes, it changes state





  • new: The process is being created.


  • running: Instructions are being executed.


  • waiting: The process is waiting for some event to occur.


  • ready: The process is waiting to be assigned to a process.


  • terminated: The process has finished execution


b)Process Control Block


- Information associated with each process.





  • Process state - The status of a process as running, ready, blocked, etc.


  • Program counter- is a processor register that indicates where the computer is in its instruction sequence. Depending on the details of the particular computer, the program counter holds either the address of the instruction being executed, or the address of the next instruction to be executed.


  • CPU registers -In computer architecture, a processor register is a small amount of storage available on the CPU whose contents can be accessed more quickly than storage available elsewhere


  • CPU scheduling information


  • Memory-management information -a multiprogramming operating system kernel must be responsible for managing all system memory which is currently in use by programs. This ensures that a program does not interfere with memory already used by another program. Since programs time share, each program must have independent access to memory.


  • Accounting information -An accounting information system (AIS) is the system of records a business keeps to maintain its accounting system. This includes the purchase, sales, and other financial processes of the business. The purpose of an AIS is to accumulate data and provide decision makers (investors, creditors, and managers) with information.



  • I/O status information


c)Threads


  • In computer science, a thread of execution results from a fork of a computer program into two or more concurrently running tasks. The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process. Multiple threads can exist within the same process and share resources such as memory, while different processes do not share these resources.



  • On a single processor, multithreading generally occurs by time-division multiplexing (as in multitasking): the processor switches between different threads. This context switching generally happens frequently enough that the user perceives the threads or tasks as running at the same time. On a multiprocessor or multi-core system, the threads or tasks will generally run at the same time, with each processor or core running a particular thread or task. Support for threads in programming languages varies: a number of languages simply do not support having more than one execution context inside the same program executing at the same time. Examples of such languages include Python, and OCaml, because the parallel support of their runtime support is limited by the use of a central lock, called "Global Interpreter Lock" in Python, "master lock" in Ocaml. Other languages may be limited because they use threads that are user threads, which are not visible to the kernel, and thus cannot be scheduled to run concurrently. On the other hand, kernel threads, which are visible to the kernel, can run concurrently.



  • Many modern operating systems directly support both time-sliced and multiprocessor threading with a process scheduler. The kernel of an operating system allows programmers to manipulate threads via the system call interface. Some implementations are called a kernel thread, whereas a lightweight process (LWP) is a specific type of kernel thread that shares the same state and information.
    Programs can have user-space threads when threading with timers, signals, or other methods to interrupt their own execution, performing a sort of ad-hoc time-slicing.

0 comments: