Chapter 3 process description and Control
1. What is a process?
A program being executed
Program instance being executed on Computer
Entity that can be allocated to the processor and executed by the processor
An activity unit with the following features: execution of a set of command sequences, a set of current states and related system resources
Processes can be characterized as the following elements:
Identifier: each process has a unique identifier.
Status:
Priority:
Program counter: the sequence of commands to be executed in the program
Memory pointer: pointer to program code and process-related data, and share the memory block pointer with other processes.
Context Data: Data in the Processor register during execution
I/O status information:
Audit information
The preceding information is placed in the -- Process Control Block.
The Process status is switched by the dispatcher.
Cause of Process Creation
1. The new batch processing job operating system accepts new jobs and reads the next job control command
2. Interactive login terminal users log on to the system
3. The operating system provides a service. The operating system creates a process to execute a function on behalf of the user program.
3. Existing process-derived User Program Creation
Process Termination
1 halt execution completed
2. Exit the terminal interactively.
3 errors or faults
5. State model and transition
Ready, run, exit, block, new
Process description
The operating system maintains four different types of tables.
Memory, I/O, files and processes
Memory table-same as primary storage and secondary storage
Process Control Structure
To manage and control processes in the operating system, you must know the process location and process attributes.
What is the physical representation of a process?
A process must include at least one or more programs executed, as well as local variables, global variables, and any defined data units associated with these programs. Therefore, you need to store the program and data of the process in the memory.
Stack of parameter passing during program execution tracing process invocation and process.
The set of attributes becomes the process control block.
The collection of programs, Data, stacks, and attributes becomes a process image.
Process images can be partially stored in primary and secondary storage. To execute the process, the entire process image must be loaded into the primary storage or load
Virtual storage. Therefore, the operating system needs to know the location of the process on the disk.
Typical process image elements
User Data
User Program
System Stack
Process Control Block
Process control blocks include
Process ID
Process status information
Process control information
Process Control
User Mode
Privileged Mode
There are two modes: Protecting the operating system and important operating system data tables from interference by user programs
One digit in the program status word represents
Process Creation
1. assign a unique ID
2. Allocate space
3. initialize the process control block
4. Set the correct connection .. Scheduling queue
5. create or expand other data structures
Process Switching
When to switch Processes
1. Interrupt --- external event reflection
2 traps --------------------- handle error exceptions
3. System Call --- Call system functions
Differences between interruptions and traps
Interrupt --- some type of external events irrelevant to the currently running process
Trap-errors or exception conditions generated by the currently running process
Common interruptions
Clock interruption
I/O interruption
Page missing for memory failure