Some notions about operationg system

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



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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值