First to understand a few concepts
Job management, communication transaction management is the most direct service provided by the operating system to the user.
Operating system Type: Single-user operating system, multi-channel batch processing system, time-sharing System (Unix system), realtime system, network operating system, distributed operating system (distributed operating system is the advanced stage of network operating system).
Operating system environment: the most important is the interrupt mechanism. Events cause interrupts, interrupts must be processed, and the operating system is driven. The operating system itself code runs in a nuclear mindset. The only way for the user to enter the nuclear mindset is to interrupt. In Unix, it is the trap (trap Gate).
Active module: The program code snippet that is involved in running the OS when it starts. Passive module: A module that is called by the active module or called by another passive module, such as an interrupt handler.
Operating system startup process:
- The first is the implementation of the ROM (ROM) in the bootstrap program (dozens of instructions);
- The bootloader, which executes the boot program, loads the OS into memory;
- Initial program, initialization and detection of various hardware and software;
- The CPU runs a "loitering" process. Loitering is an OS that performs an empty operation and the OS is in standby state.
Job Management
2.1 What do you call homework
The work of the user to make a computer is called homework;
The operation is composed of 3 parts: program, data and operation description.
the operating system jobs we are exposed to are: batch jobs and interactive jobs;
Offline is a major feature of batch jobs. Offline means not to be operated by humans again.
The interactive job is online as the primary feature.
2.2 User interface provided by the operating system
Program Interface (interface for programming system calls): It consists of a set of system invoke commands. Each system invocation instruction corresponds to a routine that is prepared beforehand by the operating system designer to perform certain functions. For user-programmed interface, the user can write system invoke commands into the program. System calls provide support to the user at the program level, so called the program interface.
Online user Interface (Keyboard action screen interface): consists of keyboard commands and screen commands. Keyboard commands are commands that are typed by the online user on the interactive terminal via the keyboard. The input of the screen command mainly depends on the mouse click, drag and move.
Offline user interface: It consists of a set of job control commands. This set of job control commands has a strong programming language feature, so it is also called the job control language. C-shell language Writing operation instructions, specifications are as follows:
86% nroff-mm Glossary > Glossary.out & [1] 26,025%: Command prompt; 86: command sequence number; Nroff: command name;-mm: parameter; Glossary: file name;: Transfer command;& : Background command (the background command only runs when the foreground command is not running); [1]: CIS sequence 26025: Process number
2.2.1 Unix system Call execution procedure
There are 64 system invoke commands in Unix. When executing the system call routine module, it involves the change of the processor operation state: The user state to the system state, and then returns to the user state after executing the routine procedure. The UNIX system invoke command is the core of the "sink" operating system by breaking the structure.
How do I find a routine inside the OS?
The entry address of the corresponding command is found through the System invoke command table, and the routine is found, followed by the execution of the routine and then returned to the calling point. Trap 03, through 03 to find the command table, thus from the user state into the nuclear mentality. Executing the trap instruction on the hardware is automatically self-trapping interrupts.
2.2.2 Keyboard command Execution procedure
- Read into the command line;
- The command interpreter separates the command name from the start terminal handler, and the Command Entry table is checked;
- Take parameters;
- into a routine that the pointer points to;
- execution routines;
- Read in the next command.
2.2.3 Screen Command execution procedure--event-driven
Event-driven generation commands--command queuing--subdivision commands (user commands, OS commands, DOS commands)--go to the appropriate handlers.
The present situation and development of 2.2.4 user interface
Screen function will be more rich;
The acceptance attachment of the screen command will be more intelligent;
2.3 Interactive Job Management
Interactive jobs have a recurring process of input (edit), compile, run, debug, recompile, and run.
2.4 Batch processing Job management
Three states: Fallback status (pre-processing)-(job scheduling)-Operational status (Job control)-(job evacuation)-completion status (after processing);
Job Login: The job Login program is responsible for setting up JCB for the job, job external memory address, job logon time, and JCB for all jobs is chained together and is customarily referred to as the job queue.
2.4.1 Operation Evacuation
remove the job's JCB from the job queue and release the various resources indicated in the JCB.
2.4.2 Job scheduling
Select a job from the backup queue to load the main memory and participate in multi-channel operation.
Common Job scheduling algorithms:
- First come first service (FCFS)-Select the job in the first position in the fallback queue;
- Short priority (SJF)-Select shortest (refers to the shortest running time of the job);
- Response to high-priority (HRN);
- Priority Method--Select the job with the highest priority level.
2.4.3 Operation Control
Job = program + data + operating instructions
The job control program is actually the explanation execution program of the job controlling command, which explains the execution of the command according to the user's Operation instruction.
A fragment of a job description:
CC f1.c/* Compile F1 module, generate f1.obj file */cc f2.c/* Compile F2 module, generate f2.obj file */link f1.obj f2.obj:/* Link two target files into an executable file F.exe-lib
In multiprocessor environment, the job control program has the ability to identify jobs, to step parallel relationships and to assign tasks.
The job control program also controls concurrent programs. The job control program is started and run as a process, called the job controlling process, it is the ancestor process of the running state job, and then the ancestor process creates the descendant process to form the process family of the job.
2.4.4 Jobs and processes
Process is proposed to describe the dynamic behavior of a task;
A job (Task) is made up of multiple processes, and the resource demand for the job equals the sum of the number of resources that its process has.
The operating system now takes the process as the basic unit of application resources and threads (thread) as the basic unit for task execution.
Operating system--job management