Operating System-Process(2)

上一篇文章阐述了进程的基本信息,本文主要介绍进程的实现,主要内容:

  1. 进程表(Process Table or Process Control Blocks)
  2. 中断处理(Interrupt)

一、进程表

操作系统以数组的形式维护了一个进程表,每个进程有一个入口,示意图如下图所示。针对每一个进程,进程表中保存着进程的状态、程序计数器(PC)、指向栈的指针、进程对应内存的地址等等。

上图中的Scheduler会处理外部的中断以及对于进程的调度。

当进程的状态有Running切换为Ready或者Blocked时,进程的所以数据都应该被正确的保存,从而当再次运行时候进程能够像从来没有被停止过一样继续运行。

二、中断处理

2.1 中断示意

上一篇文章就说了一个CPU同一时间只能运行一个进程,但是用户却有电脑同时运行很多进程的假象。上一篇文章的解释是CPU会调度,让不同的进程轮流在CPU上进行运行。这个调度在操作系统中是通过中断来实现的。比如用户正在用Word进行编辑,突然有一封邮件到达了,这个时候操作系统会产生一个中断,该中断最终会让CPU开始运行Email进程。

2.2 中断处理

上面的示意图中Word Process的状态从Running变为了Ready。等Email处理完成,CPU最终还会回到Word进程,Word进程会再次运行,上面说了当再次运行时,Word进程应该如同没有被停止过一样,如何做到?这里最主要的就是在中断发生后对当前运行进程的数据以及状态的保存。

基本流程:

时间: 2024-08-24 23:09:50

Operating System-Process(2)的相关文章

[Operating System] {Udacity} P2L1: Processes and Process Management

V0-Vmax => max size of the process address space heap and data may not be contiguous stack: last in first out any access of the process to x will access the correct physical location where x is stored. not all processes requires the entire address sp

Operating System: Three Easy Pieces --- Process (Note)

1. How can the operating system provide the illusion of a nearly-endless supply of said CPUs? The OS creates this illusion by virtualizing the CPU. The basic technique, known as the time- sharing the CPU, allows users to run as many concurrent proces

Linux Operating System

Linux is a Unix-like computer operating system assembled under the model of free and open source software developmentand distribution .The defining component of Linux is the Linux kernel , andoperating system kernel was first released October 5 , 199

General-Purpose Operating System Protection Profile

1 Protection Profile Introduction ? This document defines the security functionality expected to be provided by a general-purpose operating system capable of operating in a networked environment. It also provides a set of assurance components that de

Operating System Engineering

Operating System Engineering Course Meeting Times Lectures: 2 sessions / week, 1.5 hours / session Prerequisites 6.033 Computer System Engineering 6.170 Software Studio 6.004 Computation Structures Description 6.828 Operating System Engineering studi

POJ #2448 A New Operating System

Time Limit: 20000MS   Memory Limit: 65536K Total Submissions: 1165   Accepted: 110 Case Time Limit: 5000MS Description May is a lovely girl. Due to her filial piety, she wants to give a present on her mother's birthday. Because both her parents are t

Operating system management of address-translation-related data structures and hardware lookasides

An approach is provided in a hypervised computer system where a page table request is at an operating system running in the hypervised computer system. The operating system determines whether the page table request requires the hypervisor to process.

Operating System: Three Easy Pieces --- Mechanism: Limited Direct Execution (Note)

In order to virtualize the CPU, the operating system needs to somehow share the physical CPU among many jobs  running seemingly at the same time. The basic idea is simple: run one process for a little while, then run another, and so forth. By time sh

osquery An Operating System Instrumentation Framewor

catalog 1. Getting Started 2. install guide for OS X and Linux 3. Features Overview 4. Logging 5. query example 1. Getting Started osquery is an operating system instrumentation framework for OS X and Linux. The tools make low-level operating system

InnoDB: Operating system error number 87 in a file operation. 错误87的解决方法

InnoDB: Operating system error number 87 in a file operation. 错误87的解决方法 140628  8:10:48 [Note] Plugin 'FEDERATED' is disabled.140628  8:10:48 InnoDB: The InnoDB memory heap is disabled140628  8:10:48 InnoDB: Mutexes and rw_locks use Windows interlock