Студопедия
Случайная страница | ТОМ-1 | ТОМ-2 | ТОМ-3
АрхитектураБиологияГеографияДругоеИностранные языки
ИнформатикаИсторияКультураЛитератураМатематика
МедицинаМеханикаОбразованиеОхрана трудаПедагогика
ПолитикаПравоПрограммированиеПсихологияРелигия
СоциологияСпортСтроительствоФизикаФилософия
ФинансыХимияЭкологияЭкономикаЭлектроника

Question 1. Preemptive Multitasking

Читайте также:
  1. A question of taste. Fashion.
  2. A) Look at this extract from a TV guide and the photo and answer the questions.
  3. A) Read the article to find the answers to these questions.
  4. A) Try to answer these questions.
  5. A. Read the extract below and answer the questions.
  6. A. Read the text and answer the questions below.
  7. A. Read the text and answer the questions below.

Exercise 3

In this section you will use a Timestamp program and a graphical interface to examine how preemptive processing works.

Before executing the program, answer the following questions in the context of an operating system:

a. What is a process?

b. What does a process include?

c. Name the possible states that a process can be in.

d. What is a thread?

e. Why are threads useful?

Now let us try using the Timestamp program and run two threads.
Right-click on Timestamp.exe and save program in drive C. This program should be executed in the Windows command console. Open the Windows command console by clicking on the Start menu on desktop, and then select Run... Type " cmd" in the text field and click OK. At the prompt C:\, type " Timestamp –i 500000 –p 2 > Output.out"; press ENTER.

Note: -i specifies the number of work cycles, and -p specifies the number of threads to run.

Now use the graphical interface to see the output.
Right-click on Graph.exe and save the program in Drive C. Open the program. If Graph.exe does not run, refer to Appendix A. Running a Visual Basic File for instructions. Once Graph.exe is opened, click Select Data File, and choose the file Output.out in drive C.

Note that the horizontal axis is the number of work cycles. Each thread is distinguished by a different color. The gray areas indicate that the system is not running the given threads. A legend for the threads is displayed at the bottom of the graph.

f. Capture a screen shot of the graphical output.

g. List the order in which the threads are being executed.

h. What is a context switch? How do you know a context switch occurred from the graph?

i. What activities are performed by the processor during a context switch?

j. Explain what is happening in terms of preemptive multitasking and what effect it has to the user.

k. An interrupt indicates that the thread is not being run and should therefore be followed by a gray gap. How does the kernel handle an interrupt?

Try using more than two threads.
At the Windows command prompt C:\, type “ Timestamp –i 500000 –p [enter the number of threads to run (less than 10)]” and press ENTER.

l. Copy and paste the graphical output.

m. List the order in which the threads are being executed.

n. Consider a set of three processes that are executed to completion. Process A takes 6 seconds, Process B takes 3 seconds, and Process C takes 5 seconds. About how long would it take for all the processes to be completed using preemptive multitasking, more than 14 seconds, less than 14 seconds, or exactly 14 seconds? Explain your answer.

Now investigate your own system.

o. How much RAM (main memory) does your machine have? Show proof of your answer by submitting a screenshot of the display from which you inferred your answer.

Launch Microsoft Word if it is not already launched.

p. How many threads does Microsoft Word launch? (Refer to 3.1.4 Lab: The Task Manager.) Show proof of your answer by submitting a screenshot of the display from which you inferred your answer.

q. How much memory does Microsoft Word consume? Show proof of your answer by submitting a screenshot of the display from which you inferred your answer.


Question 2. Virtual Memory

In this section, you will use a program demonstrating how virtual memory is used.

a. How does virtual memory work using a page table?

b. What is the primary purpose of virtual memory?

c. List three advantages of using virtual memory when executing a program.

Execute the Page Replacement Simulation program.
Click on Paging.exe to run the application. Refer to Appendix A. Running a Visual Basic File if Paging.exe does not run.

Notice the top of the program window indicates the number of request and total page faults. The table on the left represents RAM and the one on the right represents the hard disk. The order of requests is set at default. You can also enter your own order of requests. To change the speed of the simulation, you can use the speed adjuster at the bottom-left of the program window. Each time you click on Stop or Pause, the simulation ends after one complete memory access.

Start the program using the default queue of requests.

d. Describe what is happening for the first seven requests step-by-step for the default order of requests.

e. When does a page fault occur, and how does the kernel handle a page fault?

f. Enter a sequence of eight requests in place of the default order of requests in the program that would cause four page faults.

g. In what case is it undesirable to use virtual memory?

h. Given a total paging file size of 267MB, and a RAM of size 256MB. Your applications are currently taking up 500MB of memory. How would you run an application that consumes 100 MB of memory?

 


Дата добавления: 2015-11-16; просмотров: 155 | Нарушение авторских прав


<== предыдущая страница | следующая страница ==>
Города Кемеровской области с население менее 100 тыс. человек| Present Simple

mybiblioteka.su - 2015-2024 год. (0.007 сек.)