操作系统基础概要

本文主要摘自Operating System Concepts By ABraham Silberschatz

Process and Thread Management
The creation and deletion of both user and system processes. The scheduling of processes. The provision of mechanisms for synchronization, communication, and deadlock handling for processes.

  • Process state:

    New: is being created.
    Running: Instructions are being exectuted
    Waiting: The process is waiting for some events to occur. I/O completion or reception of a signal
    Ready: The process is waiting to be assigned to a processor.
    Terminated: finished executing.

  • PCB:

    Contains some information of a specific process:
    Process State; Program Counter; CPU Register; CPU-Scheduling information; Memory management information

  • Process Schedule:

    processes enter the system —— job queue;
    Residing in the main memory and are ready ———- ready queue
    Waiting for device ——- device queue

    Long-term Scheduler (Job scheduler): may be absent. simply put every new process into memory. The balance between IO bounds and CPU bounds Process.

    Short-term Scheduler (CPU shceduler) FREQUENTLY:

    Medium-term Scheduler: To remove a process from memory to reduce the degree of multiprogramming. Called SWAPING!

二者最大的不同是:执行的频率上的不同!

  • Threads:

    Motivition: Web browser, word processor, manyu similar tasks
    Benifits: Responsiveness; Resource Sharing; Ecnomy; Scalability;
    User Threads and Kernel Threads:
    Many to many model: 避免了1to1的用户在一个应用程序内创建很多线程的问题!


Process Synchronization:
Critical section is a segment of code and allow only one process executing.
Critical section problem: design a protocol that the processes can use to cooperate
mutex lock: a process must acquire the lock before entering a critical section
Semaphore: wait() and signal()

CPU Scheduling:
Shecduling criteria:
CPU utilization; Throughput; Turnaround Time; Waiting time; Response Time;

Algorithms:
First Come First Served
Shoutest Job First
Priority
Round-Robin


Deadllock

A process waiting for a resources which was held by another process.

  • Necessary Conditions:
  • Mutual exclusion: only one process at a time use the resource
  • Hold and wait:
  • No preemption: Resouces can not be preempted
  • Circular wait: a set of waiting processes.

Resource-Allocation Graph.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值