<< Chapter < Page
  Operating systems     Page 4 / 4
Chapter >> Page >

In a threaded program, which resources are shared by the entire process and which are associated with each thread?

The process address space, structures used for interprocess communication, files, and I/O resources are associated with theentire process. Each thread gets its own execution state, context (registers), stack, and local variables.

Consider the following code:

  1. for (i = 0; i<10; i++)
  2. for (j = 0; j<10; j++)
  3. a[i] = a[i]* j
    • Give one example of the spatial locality in the code.

Spatial locality occurs when the array a is accessed sequentially.

  • Give one example of the temporal locality in the code.

Temporal locality occurs when i is used repeatedly with the same value in the second loop.

Consider a memory system with the following parameters:

  • Tc = 100 ns
  • Tm = 1200 ns
  • Cc = 0.01 cents/bit
  • Cm = 0.001 cents/bit
  1. What is the cost of 1 MByte of main memory?

Cost = Cm x 8 x 220 = $83.89

  1. What is the cost of 1 Mbyte of main memory using cache memory technology?

Cost = Cc x 8 x 220 = $838.86

  1. If the effective access time is 10% greater than the cache access time, what is the hit ratio H?

1.1 x Tc = Tc + (1 - H)Tm110 = 100 + (1 - H) x 12001200 x H = 1190H = 1190/1200 = 99.2%

A computer has a cache, main memory, and a disk used for virtual memory. if a referenced word is in the cache, 20 ns are required to access it.If it is in main memory but not in the cache, 60 ns are needed to load it into the cache (this includes the time to originally check the cache), and then theReference is started again. if the word is not in main memory, 12 ms are required to fetch the word from disk, followed by 60 ns to copy it to the cache,And then the reference is started again. the cache hit ratio is 0.9 and the main memory hit ratio is 0.6. what is the average time in ns required to access aReferenced word on this system?

There are three cases to consider:

Location of Word Probability Total Time for Access (ns)
In cache 0.9 20
Not in cache, but in main memory (0.1)(0.6) = 0.06 60 + 20 = 80
Not in cache or main memory (0.1)(0.4) = 0.04 12ms + 60 + 20 = 12,000,080

So the average access time would be:

Avg = (0.9)(20) + (0.06)(80) + (0.04)(12000080) = 480,026 ns

Suppose that we have a multi-programmed computer in which each job has identical characteristics. in one computation period, t, for a job, half theTime is spent in i/o and the other half in processor activity. each job runs for a total of n periods. assume that simple round-robin scheduling is used, andThat i/o operations can overlap with processor operation. define the following quantities:

  • Turnaround time = actual time to complete a job.
  • Throughput = average number of jobs completed per time period T
  • Processor utilization = percentage of time that the processor is active (waiting)

Compute these quantities for one, two, and four simultaneous jobs, assuming that the period T is distributed in each of thefollowing ways:

  1. I/O first half, processor second half

When there is one job, it can do I/O or run on the processor whenever it wants. So the quantities are:

  • Turnaround Time = N*T
  • Throughput = 1/N
  • Processor Utilization = 50%

When there are two jobs, one starts right away and does I/O. When it switches to run on the CPU, the second can start its I/O. Thisdelays the second job for 1/2*N, but otherwise they alternate between I/O and CPU. Assume the jobs are long, so the extra 1/2 a cycle is insignificant.Then:

  • Turnaround Time = N*T
  • Throughput = 2/N
  • Processor Utilization = 100%

When there are 4 jobs, the CPU is round-robin among the four, as is the I/O. This means the jobs are interleaved as:

Job1: I/O CPU I/O CPU

Job2: I/O CPU I/O CPU

Job3: I/O CPU I/O CPU

Job4: I/O CPU I/O CPU

A job can execute for one cycle T, then it must wait for T before doing another cycle. Again assume the jobs are long so that anyinitial wait is insignificant. Then:

  • Turnaround Time = (2N-1)*T
  • Throughput = 2/N
  • Processor Utilization = 100%
  • I/O first and fourth quarters, processor second and third quarter

The answers for this part are the same as the first. This is easy to see for the case of 1 job and 2 jobs. When there are 4 jobs, theCPU is round-robin among the four, as is the I/O. This means the jobs are interleaved as:

Job1: I CP O I CP O

Job2: I CP O I CP O

Job3: I CP O I CP O

Job4: I CP O I CP O

An i/o-bound program is one that, if run alone, would spend more time waiting for i/o than using the processor. a processor-bound program is theOpposite. suppose a short-term scheduling algorithm favors those programs that have used little processor time in the recent past.

  • Explain why this algorithm favors I/O-bound programs.

The algorithm favors I/O bound processes because these will be much less likely to have used the processor recently. As soon asthey are done with an I/O burst, they will get to execute on the processor.

  • Explain why this algorithm does not permanently deny processor time to processor-bound programs.

This algorithm does not permanently deny processor time to processor-bound programs, because once they have been prevented fromusing the processor for some time they will be favored by the scheduling algorithm.

Questions & Answers

how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
Maciej
Do somebody tell me a best nano engineering book for beginners?
s. Reply
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
s.
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
Virgil
is Bucky paper clear?
CYNTHIA
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Harper
Do you know which machine is used to that process?
s.
how to fabricate graphene ink ?
SUYASH Reply
for screen printed electrodes ?
SUYASH
What is lattice structure?
s. Reply
of graphene you mean?
Ebrahim
or in general
Ebrahim
in general
s.
Graphene has a hexagonal structure
tahir
On having this app for quite a bit time, Haven't realised there's a chat room in it.
Cied
what is biological synthesis of nanoparticles
Sanket Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
China
Cied
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
Porter
many many of nanotubes
Porter
what is the k.e before it land
Yasmin
what is the function of carbon nanotubes?
Cesar
I'm interested in nanotube
Uday
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
what is nano technology
Sravani Reply
what is system testing?
AMJAD
preparation of nanomaterial
Victor Reply
Yes, Nanotechnology has a very fast field of applications and their is always something new to do with it...
Himanshu Reply
good afternoon madam
AMJAD
what is system testing
AMJAD
what is the application of nanotechnology?
Stotaw
In this morden time nanotechnology used in many field . 1-Electronics-manufacturad IC ,RAM,MRAM,solar panel etc 2-Helth and Medical-Nanomedicine,Drug Dilivery for cancer treatment etc 3- Atomobile -MEMS, Coating on car etc. and may other field for details you can check at Google
Azam
anybody can imagine what will be happen after 100 years from now in nano tech world
Prasenjit
after 100 year this will be not nanotechnology maybe this technology name will be change . maybe aftet 100 year . we work on electron lable practically about its properties and behaviour by the different instruments
Azam
name doesn't matter , whatever it will be change... I'm taking about effect on circumstances of the microscopic world
Prasenjit
how hard could it be to apply nanotechnology against viral infections such HIV or Ebola?
Damian
silver nanoparticles could handle the job?
Damian
not now but maybe in future only AgNP maybe any other nanomaterials
Azam
Hello
Uday
I'm interested in Nanotube
Uday
this technology will not going on for the long time , so I'm thinking about femtotechnology 10^-15
Prasenjit
can nanotechnology change the direction of the face of the world
Prasenjit Reply
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Good
Berger describes sociologists as concerned with
Mueller Reply
Got questions? Join the online conversation and get instant answers!
QuizOver.com Reply

Get the best Algebra and trigonometry course in your pocket!





Source:  OpenStax, Operating systems. OpenStax CNX. Aug 13, 2009 Download for free at http://cnx.org/content/col10785/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Operating systems' conversation and receive update notifications?

Ask