Docsity

Applied Software Engineering Problem Set 3 Solutions - Virginia Tech ECE 3574 - Prof. Bino, Assignments of Software Engineering

Toggle sidebar
bg1
ECE 3574: Applied Software Engineering Fall 2007 Problem Set 3
Virginia Tech
Bradley Department of Electrical and Computer Engineering
ECE 3574: Applied Software Engineering
Fall 2007
Homework Problem Set 3 Solutions
Submission Details
The solutions for this problem set must be submitted as an electronic submission. Your submission
will ideally be a zip/tar file containing the document file that contains the answers to the questions,
and the relevant source files for the programming questions. The following information must be
included at the top of the first page of your document: your full name, your student ID number, your
email address, class (ECE 3574), title of the assignment (Homework Problem Set 3), and date of
submission. You must submit the solutions using the “Digital Drop box” at the class web site1. The
file must be given a name of the following form: LAST_FIRST_hw3.zip or LAST_FIRST_hw3.tar.
Paper and email submissions will not be accepted. All work must be submitted by the announced
due date/time.
Questions
Use the Homework 3 forum in the Discussion Board area of the class web site to ask questions about
this assignment. Do not post questions that contain specific information about the solution.
Honor Code
As stated in the syllabus, in working on problem sets, discussion and cooperative learning are
allowed. However, copying or otherwise using another person’s detailed solutions to assigned
problems is an honor code violation. See syllabus for details.
1 The class web site is accessed at http://www.learn.vt.edu/.
pf3
pf4

Partial preview of the text

Download Applied Software Engineering Problem Set 3 Solutions - Virginia Tech ECE 3574 - Prof. Bino and more Assignments Software Engineering in PDF only on Docsity!

Virginia Tech Bradley Department of Electrical and Computer Engineering ECE 3574: Applied Software Engineering  Fall 2007

Homework Problem Set 3 Solutions

Submission Details

The solutions for this problem set must be submitted as an electronic submission. Your submission will ideally be a zip/tar file containing the document file that contains the answers to the questions, and the relevant source files for the programming questions. The following information must be included at the top of the first page of your document: your full name, your student ID number, your email address, class (ECE 3574), title of the assignment (Homework Problem Set 3), and date of submission. You must submit the solutions using the “Digital Drop box” at the class web site 1. The file must be given a name of the following form: LAST _ FIRST _hw3.zip or LAST _ FIRST _hw3.tar. Paper and email submissions will not be accepted. All work must be submitted by the announced due date/time.

Questions Use the Homework 3 forum in the Discussion Board area of the class web site to ask questions about this assignment. Do not post questions that contain specific information about the solution.

Honor Code As stated in the syllabus, in working on problem sets, discussion and cooperative learning are allowed. However, copying or otherwise using another person’s detailed solutions to assigned problems is an honor code violation. See syllabus for details.

(^1) The class web site is accessed at http://www.learn.vt.edu/.

  1. Describe the differences among short-term, medium-term, and long-term scheduling.

Answer:

  • Short-term ( CPU scheduler)—selects from jobs in memory those jobs tha t are ready to execute and a l locates the CPU to them.
  • Medium-term —used especia l ly with time-sharing systems as an intermediate scheduling level. A swapping scheme is implemented to remove parti a l ly run programs from memory and reinstate them later to continue where they left off.
  • Long-term (job scheduler)—determines which jobs are brought into memory for processing. The primary difference is in the frequency of their execution. The short-term must select a new process quite often. Long-term is used much less often since it handles placing jobs in the system and may wait a whi le for a job to finish before it admits another one.
  1. Describe the actions taken by a kernel to context-switch between processes.

Answer: In general, the operating system must save the state of the currently running process and restore the state of the process scheduled to be run next. Saving the state of a process typical ly includes the values of al l the CPU registers in addition to memory al location. Context switches must also perform many archi tecture-specific operations, including flushing data and instruction caches.

3. Using the program given in fork-3-24.c, expla in wh a t wil l be the output at Line A.

  1. Wha t are the benefits and detriments of each of the fol lowing? a. Synchronous and asynchronous communication b. Automatic and explicit buffering

Answer: a. Synchronous and asynchronous communication - A benefit of synchronous communication is tha t it al lows a rendezvous between the sender and receiver. A disadvantage of a blocking send is tha t a rendezvous may not be required and the message could be delivered asynchronously; received at a point of no interest to the sender. As a result, message-passing systems often provide both forms of synchronization.

b. Automatic and explicit buffering -Automatic buffering provides a queue with indefinite length; thus ensuring the sender wil l never have to block wh i le waiting to copy a message. There are no specifications how automatic buffering will be provided; one scheme may reserve sufficiently l arge memory where much of the memory is wasted. Explicit buffering specifies how large the buffer is. In this situation, the sender may be blocked whi le waiting for ava i l able space in the queue. However, it is less likely memory wil l be wasted with explicit buffering.

5. The Fibonacci sequence is the series of numbers 0 , 1 , 1 , 2 , 3 , 5 , 8 , .... Formal ly, it can be expressed as: f ib 0 = 0 f ib 1 = 1 f ib n = f ib n  1 + f ib n  2

Wri te a C program using the fork() system call th a t generates the Fibonacci sequence in the

chi ld process. The number of the sequence will be provided in the command line. For example, if 5

synchronized using the wait() system cal l; the parent process wil l invoke wait() , which wil l

cause it to be suspended until the chi ld process exits.