期末復(fù)習(xí) Operating Systems

Q1

1. An operating system is the most important software that runs on a computer and provides

services to applications. It manages the computer's memory, processes, and all of its

software and hardware. It also allows a user to communicate with the computer without

knowing how to speak the computer's language and its details.

? The computer can be a networked system with many servers

? It hides the “messy” details using a level of abstraction

? It presents the user with a simplified machine, much easier to use

? It executes user’s programs on a specific platform

? It uses the computer hardware and resources efficiently

2. Client obtains service by sending messages to server processes through microkernel.

Benefits

? Uniform interface on request made by a process

all services are provided by means of message passing (through the microkernel)

? Extensibility

allows the addition of new services

? Portability/Maintainability

changes needed to port the system to a new processor are made within the microkernel -

not in the other services

Weakness

In a micro kernel architecture applications communicate with service via the kernels interprocess communication channels. As Operating System services execute in user space the

kernel must perform multiple context switches in order to service the request. In the

monolithic kernel architecture, the core services are implemented in the kernel, no context

switch is required (only an escalation of privilege). Due to this micro kernels are often slower

compared to monolithic kernels, i.e. less efficient


3.

? External fragmentation occurs when holes appear in

otherwise contiguous memory blocks

? Internal fragmentation occurs when the block of memory

allocated to a process is larger than the memory that process

requires

4.

(1)First fit:

A:9-12

B:1

(2)Best fit:

A:15-18

B:1

(3)Worst fit:

A:9-12

B:15

5.

Advantages:

1.Cheaper in large disk subsystems, RAID1 need as twice as many disks are needed to store

data.

2. Good general performance

Disadvantages:

1. RAID1 has better security as it provide a redundancy of all data.

2. Need additional CPU performance to calculate parity

6.

Limited power in processor

Limited Space

Q2

a.(1)

fork() creates a new process

? Requires no arguments, returns identifier of child process

? Creates an exact copy of the parents address space for new process.

? Child process continues executing from where the fork() call was made in the parent

process

? Returns zero to the newly created child process

(2)

pipe() creates a pipe, a unidirectional data channel that can be used for interprocess

communication. The array pipefd is used to return two file descriptors referring to the ends

of the pipe. pipefd[0] refers to the read end of the pipe. pipefd[1] refers to the write end of

the pipe. Data written to the write end of the pipe is buffered by the kernel until it is read

from the read end of the pipe.

(3)

0

After the fork function, the child process and the parent process use separate addresses in

memory, and changes to the parameters in the child process do not affect the parent process.

(4)

0 1 2 3 4

b.

What are threads?

? Multiple concurrent paths of execution within process

? Lightweight process

? Unit of dispatching (execution)

? Threads in a process share address space

? Separate concurrency from protection

Why use multithreading?

Primary Benefits

? Responsiveness : applications can continue executing while parts are blocked

? Resource sharing : Threads share code and data

? Economy : Cheaper to create threads than processes

? Multiprocessor utilisation : threads can utilise parallel execution

Separates resource ownership and scheduling

? Multithreading is rarely used without requiring some access to shared resources

Application threads must map to a kernel execution thread

? User level : Many to one mapping

? Kernel level : One to One mapping

User level threads

Threads exist only in user space, kernel knows nothing about them

? Require a runtime package to implement the threads and keep track of them

? Can be used on systems that do not support threading


Benefits

? Cheap to create

? Cheap context switches

? Thread yields don’t result in process context switch

? Application specific scheduling

Drawbacks

? Blocking system calls can block entire process

? Errors propagate to whole process

? No clock interrupts, scheduler runs at same level

as thread

? No benefits from multi-processor systems

Kernel level threads

Kernel has full knowledge of all threads and processes

? A kernel thread is created for each user thread

? Requires specific kernel support

Benefits

? Kernel has full control of thread scheduling.

May give more time to processes with more

threads.

? Errors stop threads not processes

? Kernel handles blocking system calls

Drawbacks

? Operations much slower than user level

threads

? Significant overhead for kernel. It must

manage and schedule processes and threads.

c.

HOW

the output is dependent on the sequence or timing of other uncontrollable events. It becomes

a bug when events do not happen in the order the programmer intended.

Results:

Execution may fail sporadically and with strange, unreproducible output

Solving requires mutual exclusion

? Ensure only one process or thread can do the same thing to a shared variable or file

? Access to shared resources must be synchronised to avoid inconsistencies

Critical Section

Part of a cooperating processes (or threads) where a shared

resource is accessed and must be executed atomically

Problem solution requires:

?Mutual exclusion: No two processes or threads can be in their related

critical sections at the same time

?Progress: Progress cannot be delayed by another process or thread not

in a critical section

?Bounded Waiting: No process or threads should wait forever to enter its

critical section

MapReduce

Long Tail phenomena

Possible mitigation strategy:

Monitoring

Scheduling: Load Balancing

Fault-tolerance

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市担映,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌沥割,老刑警劉巖嗽桩,帶你破解...
    沈念sama閱讀 222,865評論 6 518
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件传透,死亡現(xiàn)場離奇詭異耘沼,居然都是意外死亡,警方通過查閱死者的電腦和手機朱盐,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,296評論 3 399
  • 文/潘曉璐 我一進(jìn)店門群嗤,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人兵琳,你說我怎么就攤上這事狂秘。” “怎么了躯肌?”我有些...
    開封第一講書人閱讀 169,631評論 0 364
  • 文/不壞的土叔 我叫張陵者春,是天一觀的道長。 經(jīng)常有香客問我羡榴,道長碧查,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 60,199評論 1 300
  • 正文 為了忘掉前任校仑,我火速辦了婚禮忠售,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘迄沫。我一直安慰自己稻扬,他們只是感情好,可當(dāng)我...
    茶點故事閱讀 69,196評論 6 398
  • 文/花漫 我一把揭開白布羊瘩。 她就那樣靜靜地躺著泰佳,像睡著了一般。 火紅的嫁衣襯著肌膚如雪尘吗。 梳的紋絲不亂的頭發(fā)上逝她,一...
    開封第一講書人閱讀 52,793評論 1 314
  • 那天,我揣著相機與錄音睬捶,去河邊找鬼黔宛。 笑死,一個胖子當(dāng)著我的面吹牛擒贸,可吹牛的內(nèi)容都是我干的臀晃。 我是一名探鬼主播,決...
    沈念sama閱讀 41,221評論 3 423
  • 文/蒼蘭香墨 我猛地睜開眼介劫,長吁一口氣:“原來是場噩夢啊……” “哼徽惋!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起座韵,我...
    開封第一講書人閱讀 40,174評論 0 277
  • 序言:老撾萬榮一對情侶失蹤险绘,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后誉碴,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體宦棺,經(jīng)...
    沈念sama閱讀 46,699評論 1 320
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 38,770評論 3 343
  • 正文 我和宋清朗相戀三年翔烁,在試婚紗的時候發(fā)現(xiàn)自己被綠了渺氧。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 40,918評論 1 353
  • 序言:一個原本活蹦亂跳的男人離奇死亡蹬屹,死狀恐怖侣背,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情慨默,我是刑警寧澤贩耐,帶...
    沈念sama閱讀 36,573評論 5 351
  • 正文 年R本政府宣布,位于F島的核電站厦取,受9級特大地震影響潮太,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 42,255評論 3 336
  • 文/蒙蒙 一铡买、第九天 我趴在偏房一處隱蔽的房頂上張望更鲁。 院中可真熱鬧,春花似錦奇钞、人聲如沸澡为。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,749評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽媒至。三九已至,卻和暖如春谷徙,著一層夾襖步出監(jiān)牢的瞬間拒啰,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,862評論 1 274
  • 我被黑心中介騙來泰國打工完慧, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留谋旦,地道東北人。 一個月前我還...
    沈念sama閱讀 49,364評論 3 379
  • 正文 我出身青樓骗随,卻偏偏與公主長得像蛤织,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子鸿染,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 45,926評論 2 361

推薦閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,350評論 0 10
  • **2014真題Directions:Read the following text. Choose the be...
    又是夜半驚坐起閱讀 9,590評論 0 23
  • The Inner Game of Tennis W Timothy Gallwey Jonathan Cape ...
    網(wǎng)事_79a3閱讀 12,110評論 3 20
  • 2017年暑假指蚜,我認(rèn)識了他。他對我來說很遙遠(yuǎn)涨椒。而深深吸引我的是對人對事的態(tài)度摊鸡。他說他是一個問題小孩。他說他叛逆蚕冬。他...
    Wink鐽閱讀 1,715評論 0 1
  • 今天看的視頻是一個大學(xué)生演講的免猾,語言的力量《谌龋可能她說的沒有其他科學(xué)家說的那么有科學(xué)數(shù)據(jù)作為理論依據(jù)猎提,和各種數(shù)學(xué)知識...
    淡墨非痕閱讀 184評論 0 0