10 Problems on System Programming - Assignment 1 | CS 241, Assignments of Computer Science

Material Type: Assignment; Professor: Gupta; Class: System Programming; Subject: Computer Science; University: University of Illinois - Urbana-Champaign; Term: Spring 2007;

Typology: Assignments

Pre 2010

Uploaded on 03/10/2009

koofers-user-756
koofers-user-756 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Shadow Homework 1 – System Programming
(Processes and Threads)
Posted January 30, 2007 (NOT GRADED)
Problem 1: In a system with threads, is there normally one stack per thread or one stack
per process? Explain.
Problem 2: What are the three main states that a process can be in? Describe the meaning
of each one briefly as well as the relation among them.
Problem 3: What common events lead to the creation of a process?
Problem 4: What does it mean to preempt a process? Give an example when a running
process must be preempted.
Problem 5: Justify why a process needs a blocked state. What kind of programs could
processes run if we could have only running and ready states?
Problem 6: Write a C program where a process creates a child process and each of them
prints each other’s PID, i.e, parent prints the child’s PID and child prints the parent’s PID.
Problem 7: Consider the following steps when a process is switched: (a) Scheduler
receives an interrupt; (b) Scheduler preempts the running process; (c) Scheduler selects
another process for execution, (d) Scheduler updates the process control block of the
selected process. Is this sequence of steps complete? Explain.
Problem 8: List four reasons why a mode switch between threads may be cheaper than a
mode switch between processes.
Problem 9: It was pointed out that two advantages of using multiple threads within a
process are: (1) less work is involved in creating a new thread within an existing process
than in creating a new process, and (2) communication among threads within the same
process is simplified. Is it also the case that a mode switch between two threads within
the same process involves less work than a mode switch between two threads in different
processes?
Process10: What resources are typically shared by all of the threads of a process?

Partial preview of the text

Download 10 Problems on System Programming - Assignment 1 | CS 241 and more Assignments Computer Science in PDF only on Docsity!

Shadow Homework 1 – System Programming

(Processes and Threads)

Posted January 30, 2007 (NOT GRADED)

Problem 1: In a system with threads, is there normally one stack per thread or one stack per process? Explain.

Problem 2: What are the three main states that a process can be in? Describe the meaning of each one briefly as well as the relation among them.

Problem 3: What common events lead to the creation of a process?

Problem 4: What does it mean to preempt a process? Give an example when a running process must be preempted.

Problem 5: Justify why a process needs a blocked state. What kind of programs could processes run if we could have only running and ready states?

Problem 6: Write a C program where a process creates a child process and each of them prints each other’s PID, i.e, parent prints the child’s PID and child prints the parent’s PID.

Problem 7: Consider the following steps when a process is switched: (a) Scheduler receives an interrupt; (b) Scheduler preempts the running process; (c) Scheduler selects another process for execution, (d) Scheduler updates the process control block of the selected process. Is this sequence of steps complete? Explain.

Problem 8: List four reasons why a mode switch between threads may be cheaper than a mode switch between processes.

Problem 9: It was pointed out that two advantages of using multiple threads within a process are: (1) less work is involved in creating a new thread within an existing process than in creating a new process, and (2) communication among threads within the same process is simplified. Is it also the case that a mode switch between two threads within the same process involves less work than a mode switch between two threads in different processes?

Process10: What resources are typically shared by all of the threads of a process?