some notions about os
1. Multiprogramming system provide an environment in which the various resources
(like CPU,memory,and peripheral devices) are utilized effectively,but they do
not provide for user interaction with the computer system.
2. Time sharing(or multitasking) is a logical extension of multiprogramming.
In time sharing systems,the CPU executes multiple jobs by switching among them
but the switches occur so frequently that the users can interact with each
program while it is running.Time sharing requires an interactive(or hands-on)
computer system,which provides direct communication between the user and the
system.
3.Interrupt driven.
Modern operating systems are interrupt driven.If there are no processes to
execute,no I/O devices to service,and no users to whom to respond,an operating
system will sit quietly,waiting for something to happen.Events are almost
always signaled by the occurrence of an interrupt or a trap.
A trap (or an exception) is a software-generated interrupt caused either
by an error(for example,division by zero or invalid memory access) or by a
specific request from a user program that an operating-system service be perf-
ormed.
The interrupt-driven nature of an os defines that system's general structure
For each type of interrupt, separate segments of code in the os determine what
action should be taken.An interrupt service routine is provided that is
responsible for dealing with the interrupt
4.Dual-Mode operation
In order to ensure the proper execution of the os,we must be able to distinguish
between the execution of operating-system code and user defined code.The approach
taken by most computer system is to provide hardware support that allows us to
differentiate among various modes of execution.
At the very least, we need two separate modes of operation:User mode and
Kernel mode(also called supervisor mode,system mode,or privileged mode).A bit,
called the mode bit,is added to the hardware of the computer to indicate the
current mode:kernel(0) or user(1). With the mode bit,we are able to distinguish
between a task that is executed on behalf of the os and one that is executed on
behalf of the user.When the computer system is executing on behalf of a user
application,the system is in user mode.However, when a user application request
a service from the os(via a system call) it must transition from user to kernel
mode to fulfill the request.
At system boot time, the hardware starts in kernel mode. The os is then
loaded and starts user applications in user mode.Whenever a trap or interrupt
occurs,the hardware switches from user mode to kernel mode(that is ,changes the
state of the mode bit to 0),Thus,whenever the os gains control of the computer
it is in kernel mode.The system always switches to user mode(by setting the mode
bit to 1) before passing control to a user program.
The dual mode of operation provides us with the means for protecting the os
from errant users---and errant users from one another. we accomplish this protection
by designating some of the machine instructions that may cause harm as privileged
instructions.The hardware allows privileged instructions to be executed only in
kernel mode.If an attempt is made to execute a privileged instruction in user
mode,the hardware doesn't execute the instruction but rather treats it as illegal
and traps it to the os.
5.System call
System calls provide the means for a user program to ask the os to perform
tasks reserved for the os on the user program's behalf.A system call is invoked
in a variety of ways,depending on the functionality provided by the underlying
processor.
When a system call is executed,it is treated by the hardware as a software
interrupt.The system call service routine is a part of the os.The kernel examines
the interrupting instruction to determine what system call has occurred; a parameter
indicates what type of service the user program is requesting.
6.Timer
We must ensure that the os maintains control over the CPU.We cannot allow
a user program to get stuck in an infinite loop or to fail to call system service
and never return control to the os.To accomplish this goal,we can use a timer.
A timer can be set to interrupt the computer after a specficial period.A variable
timer is generally implemented by a fixed-rate clock and a counter.The os sets
the counter.Every time the clock ticks,the counter is decremented.When the counter
reaches 0, an interrupt occurs.For instance,a 10-bit counter with a 1-millisecond
clock allows interrupts at intervals from 1 millisecond to 1024 milliseconds,
in steps of 1 millisecond.
7.pc(program counter)
A single-threaded process has one program counter specifying the next
instruction to execute.A multithreaded process has multiple program counters,
each pointing to the next instruction to execute for a given thread.
A process is the unit of work in a system. Such a system consists of a
collection of processes,some of which are os processes(those that execute system
code)and the rest of which are user processes.All these processes can potentially
execute concurrently--by multiplexing on a single CPU,for example.
The os is responsible for the following activities in connection with
process management:
Scheduling processes and threads on the CPUs
Suspending and resuming process
providing mechanisms for process synchronization
providing mechanisms for process communication
9.hierarchical storage structure
the same data may appear in different levels of the storage
system.For instance, data transfer from cache
to CPU and registers is usually a hardware function, with no operating-system
intervention. In contrast, transfer of data from disk to memory is usually
controlled by the operating system.
In a hierarchical storage structure, the same data may appear in different
levels of the storage system. For example, suppose that an integer A that is to
be incremented by 1 is located in file B, and file B resides on a magnetic disk.
The increment operation proceeds by first issuing an I/O operation to copy the
disk block on which A resides to main memory. This operation is followed by
copying A to the cache and to an internal register. Thus, the copy of A appears
in several places: on the magnetic disk, in main memory, in the cache, and in an
internal register (see Figure 1.12). Once the increment takes place in the internal
register, the value of A differs in the various storage systems. The value of A
becomes the same only after the new value of A is written from the internal
register back to the magnetic disk.
In a computing environment where only one process executes at a time,
this arrangement poses no difficulties, since an access to integer A will always
be to the copy at the highest level of the hierarchy. However, in a multitasking
environment, where the CPU is switched back and forth among various
processes, extreme care must be taken to ensure that, if several processes wish
to access A, then each of these processes will obtain the most recently updated
he situation becomes more complicated in a multiprocessor environment
, where, in addition to maintaining internal registers, each of the
CPUs also contains a local cache. In such an environment, a copy of A may
exist simultaneously in several caches. Since the various CPUs can all execute
concurrently, we must make sure that an update to the value of A in one cache
is immediately reflected in all other caches where A resides. This situation is
called cache coherency, and it is usually a hardware problem (handled below
the operating-system level).
In a distributed environment, the situation becomes even more complex.
In this environment, several copies (or replicas) of the same file can be kept
on different computers that are distributed in space. Since the various replicas
may be accessed and updated concurrently, some distributed systems ensure
that, when a replica is updated in one place, all other replicas are brought up
to date as soon as possible. There are various ways to achieve this guarantee,
as we discuss in later.
some notions about os的更多相关文章
- NodeJs之OS
OS Node.js提供了一些基本的底层操作系统的模块OS. API var os = require('os'); console.log('[arch] 操作系统CPU架构'+os.arch()) ...
- Node.js:OS模块
os模块,可以用来获取操作系统相关的信息和机器物理信息,例如操作系统平台,内核,cpu架构,内存,cpu,网卡等信息. 使用如下所示: const os = require('os'); var de ...
- Xamarin+Prism开发详解四:简单Mac OS 虚拟机安装方法与Visual Studio for Mac 初体验
Mac OS 虚拟机安装方法 最近把自己的电脑升级了一下SSD固态硬盘,总算是有容量安装Mac 虚拟机了!经过心碎的安装探索,尝试了国内外的各种安装方法,最后在youtube上找到了一个好方法. 简单 ...
- Mac OS 使用 Vagrant 管理虚拟机(VirtualBox)
Vagrant(官网.github)是一款构建虚拟开发环境的工具,支持 Window,Linux,Mac OS,Vagrant 中的 Boxes 概念类似于 Docker(实质是不同的),你可以把它看 ...
- Mac OS、Ubuntu 安装及使用 Consul
Consul 概念(摘录): Consul 是 HashiCorp 公司推出的开源工具,用于实现分布式系统的服务发现与配置.与其他分布式服务注册与发现的方案,比如 Airbnb 的 SmartStac ...
- java 利用ManagementFactory获取jvm,os的一些信息--转
原文地址:http://blog.csdn.net/dream_broken/article/details/49759043 想了解下某个Java项目的运行时jvm的情况,可以使用一些监控工具,比如 ...
- 让 ASP.NET vNext 在 Mac OS 中飞呀飞。。。
写在前面 阅读目录: 娓娓道来 Install ASP.NET vNext Command Line Tools 安装 Homebrew 使用 Homebrew,安装 KVM Install Subl ...
- Mac OS X 上编写 ASP.NET vNext (二) IDE配置
上一篇中介绍了如何在OS X上搭建.Net运行时.不过光有运行时还不够,还需要有一个好用的IDE,有了IDE的支持,OS X上的开发才称为可能. 和上篇类似,这里先列举出具体步骤,个人可以根据自己的情 ...
- 在Mac OS X上安装ASP.NET 5(译文)
ASP.NET 5 运行在包括OS X的可用于多个平台的.NET Execution Environment(DNX)上.本文介绍如何在OS X上通过HomeBrew安装DNX和ASP.NET 5. ...
随机推荐
- 折扣&折让-看清实质的思考
折扣&折让 看清实质的思考 Author:zfive5(zidong) Email:zfive5@163.com 引子 有些东西,在没有人指点的情况,一时理解不了,就放一放,等到某一个契机到来 ...
- Kafka 高性能吞吐揭秘
Kafka 高性能吞吐揭秘 Kafka作为时下最流行的开源消息系统,被广泛地应用在数据缓冲.异步通信.汇集日志.系统解耦等方面.相比较于RocketMQ等其他常见消息系统,Kafka在保障了大部分 ...
- A Game of Thrones(11) - Daenerys
Daenerys Targaryen wed Khal Drogo with fear and barbaric([bɑː'bærɪk]野蛮的,粗野的) splendor(光彩:壮丽) in a fi ...
- poj3662(二分+最短路)
题目连接:http://poj.org/problem?id=3662 题意:有n个节点p条无向边,现在可以选择其中的任意K条免费,则花费为除了k条边后权值最大的一个,求最小花费多少. 分析:二分枚举 ...
- SESC中的热量模拟器
SESC安装见前文 配置sesc支持热量模拟 ../sesc/configure --enable-power --enable-therm make 遇到问题: 1 找不到 liblevmar.a ...
- Python做的眼睛护士
搞了两天终于搞定了,虽然还存在一点点小问题(窗口的显示位置应该设在(0,0)).但基本可以用了. 代码分两个部分.主界面和遮挡屏幕界面.主界面设置完时间后调用遮挡屏幕界面. 1.主界面(设置 工作时间 ...
- Codeforces Round #253 DIV1 C 馋
http://codeforces.com/contest/442/problem/C 题意非常easy,基本上肯定有坑坑洼洼的样子.看题目案例,从第三个跟第二个没有凹的案例来看的话,多写几个以及多画 ...
- Coreseek:indexer crashed神秘
浩哥前两天让我再Coreseek该指数再次这样做,由于需求方面变化不大,公司名称应出现指数.在添加的配置文件的面孔sql_field_string:串场.. 此属性特别有用,因为它不仅作为过滤器的特性 ...
- WPF界面设计技巧(5)—自定义列表项呈现内容
原文:WPF界面设计技巧(5)-自定义列表项呈现内容 接续上次的程序,稍微改动一下原有样式,并添加一个数据模板,我们就可以达成下面这样的显示功能: 鼠标悬停于文件列表项上,会在工具提示中显示图像缩略图 ...
- 图片预览插件 fancyBox
今天给大家分享一款优秀的 jquery 弹出层展示插件 fancybox. 它除了能够展示图片之外,还能够展示 flash.iframe 内容.html 文本以及 ajax 调用.我们能够通过 css ...