ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > zstu-(2021-2022)-1 > student homework directories > 2019333500159厉霖开 >
2019333500159厉霖开Homework2 Version 0
👤 Author: by nintendolinkfoxmailcom 2021-10-06 14:39:54 last modified by nintendolinkfoxmailcom
Q1:Describe their relation and difference for process and program.
Q2:Why the status of process is divided into five states, not other numbers, such as 4,7?
Q3:Describe the contents of process control block.

A1:

1) Some detailed information from the Internet

  1. Program :


When we execute a program that was just compiled, the OS will generate a process to execute the program. Execution of the program starts via GUI mouse clicks, command line entry of its name, etc. A program is a passive entity as it resides in the secondary memory, such as the contents of a file stored on disk. One program can have several processes.

  1. Process :


The term process (Job) refers to program code that has been loaded into a computer’s memory so that it can be executed by the central processing unit (CPU). A process can be described as an instance of a program running on a computer or as an entity that can be assigned to and executed on a processor. A program becomes a process when loaded into memory and thus is an active entity.



2) My opinion and summary to question 1

  1. Process is a program in execution.

  2. One program can have several processes.

  3. Program contains a set of instructions designed to complete a specific task.

  4. The nature of the program is passive as it does nothing until it gets executed whereas a process is dynamic or active in nature as it is an instance of executing program and perform the specific action.

  5. A program has a longer lifespan because it is stored in the memory until it is not manually deleted while a process has a shorter and limited lifespan because it gets terminated after the completion of the task.

  6. The resource requirement is much higher in case of a process; it could need processing, memory, I/O resources for the successful execution. In contrast, a program just requires memory for storage.


A2:

1) Knowledge about five states from textbook

As a process executes, it changes state. The state of a process is defined in part by the current activity of that process. Each process is divided into the following five states:

  • New. The process is being created.

  • 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).

  • Ready. The process is waiting to be assigned to a processor.

  • Terminated. The process has finished execution.


2) My opinion to the question 2

The reason why the status of process does not use other numbers is the operating system needs these five states to execute a process and to determine whether state a process currently is. With numbers, the operating system can't tell the difference between different states.

A3:

1) Knowledge about PCB from textbook

Each process is represented in the operating system by a process control block (PCB)—also called a task control block. A PCB is shown in Figure 3.3. It contains many pieces of information associated with a specific process, including these:

  • Process state. The state may be new, ready, running, waiting, halted, and so on.

  • Program counter. The counter indicates the address of the next instruction to be executed for this process.

  • CPU registers. The registers vary in number and type, depending on the computer architecture. They include accumulators, index registers, stack pointers, and general-purpose registers, plus any condition-code information. Along with the program counter, this state information must be saved when an interrupt occurs, to allow the process to be continued correctly afterward (Figure 3.4).

  • CPU-scheduling information. This information includes a process priority, pointers to scheduling queues, and any other scheduling parameters. (Chapter 5 describes process scheduling.)

  • Memory-management information. This information may include such items as the value of the base and limit registers and the page tables, or the segment tables, depending on the memory system used by the operating system (Chapter 8).

  • Accounting information. This information includes the amount of CPU and real time used, time limits, account numbers, job or process numbers, and so on.

  • I/O status information. This information includes the list of I/O devices allocated to the process, a list of open files, and so on.


2) My opinion and summary to the question 3

There are process state, program counter, CPU registers, CPU scheduling information, memory-management information, accounting information and I/O status information in process control block(PCB).

Please login to reply. Login

Reversion History

Loading...
No reversions found.