Homework Assignment #1 J. H. Wang Oct. 11, 2013.

Slides:



Advertisements
Similar presentations
3.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Process An operating system executes a variety of programs: Batch system.
Advertisements

Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Review: Chapters 1 – Chapter 1: OS is a layer between user and hardware to make life easier for user and use hardware efficiently Control program.
Day 10 Threads. Threads and Processes  Process is seen as two entities Unit of resource allocation (process or task) Unit of dispatch or scheduling (thread.
Processes CSCI 444/544 Operating Systems Fall 2008.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
3.5 Interprocess Communication
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
CSSE Operating Systems
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Process Concept An operating system executes a variety of programs
Guide To UNIX Using Linux Third Edition
Phones OFF Please Processes Parminder Singh Kang Home:
Chapter Seven Advanced Shell Programming. 2 Lesson A Developing a Fully Featured Program.
Operating System Program 5 I/O System DMA Device Driver.
CE Operating Systems Lecture 5 Processes. Overview of lecture In this lecture we will be looking at What is a process? Structure of a process Process.
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-1 Process Concepts Department of Computer Science and Software.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
1 Confidential Enterprise Solutions Group Process and Threads.
Homework Assignment #2 J. H. Wang Nov. 1, 2013.
Homework Assignment #1 J. H. Wang Oct. 2, 2015.
Homework Assignment #1 J. H. Wang Oct. 13, Homework #1 Chap.1: 1.24 Chap.2: 2.13 Chap.3: 3.5, 3.13* (or 3.14*) Chap.4: 4.6, 4.12* –(*: optional.
Threads G.Anuradha (Reference : William Stallings)
Copyright ©: University of Illinois CS 241 Staff1 Threads Systems Concepts.
CE Operating Systems Lecture 10 Processes and process management in Linux.
Agenda  Working with Processes: Purpose Running Programs within same process (execl, execlp, execle, execv, execvp, execve) “Spawning” other process (fork,
System calls for Process management
Homework Assignment #1 J. H. Wang Oct. 6, 2011.
Silberschatz, Galvin and Gagne  Operating System Concepts Process Concept An operating system executes a variety of programs:  Batch system.
IR Homework #1 By J. H. Wang Mar. 5, Programming Exercise #1: Indexing Goal: to build an index for a text collection using inverted files Input:
Operating Systems Process Creation
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 14 Threads 2 Read Ch.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 4: Threads.
4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING SUSE Lab.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
Homework #1: C++ Basics, Flow of Control, and Function Basics
CS 390 Unix Programming Environment
Processes. Process Concept Process Scheduling Operations on Processes Interprocess Communication Communication in Client-Server Systems.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Homework Assignment #1 J. H. Wang Sep. 22, Homework #1 Chap.2: 2.10 Chap.3: 3.1, 3.4, 3.5* (or 3.6*) Chap.4: 4.6, 4.8* (Optional: End-of-chapter.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 2.
System calls for Process management Process creation, termination, waiting.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
Chapter 4 – Thread Concepts
OPERATING SYSTEM CONCEPT AND PRACTISE
Homework Assignment #2 J. H. Wang Oct. 25, 2016.
Processes and threads.
Chapter 3: Processes.
Chapter 3: Process Concept
Protection of System Resources
Homework Assignment #1 J. H. Wang Oct. 11, 2016.
Chapter 4 – Thread Concepts
Homework Assignment #2 J. H. Wang Oct. 24, 2017.
Homework #2 J. H. Wang Oct. 19, 2017.
Process Management Presented By Aditya Gupta Assistant Professor
Chapter 3: Process Concept
Example questions… Can a shell kill itself? Can a shell within a shell kill the parent shell? What happens to background processes when you exit from.
Threads & multithreading
Lecture 2: Processes Part 1
ICS 143 Principles of Operating Systems
Chapter 2: The Linux System Part 2
Chapter 3: Processes.
Homework #1 Chap. 1, 3, 4 J. H. Wang Oct. 2, 2018.
Homework #2 J. H. Wang Oct. 18, 2018.
Processes Creation and Threads
Chapter 3: Process Management
Presentation transcript:

Homework Assignment #1 J. H. Wang Oct. 11, 2013

Homework #1 Chap.1: 1.8 Chap.2: 2.10 Chap.3: 3.1, 3.14*, 3.15* (*: optional programming exercises) Optional bonus: End-of-chapter programming projects for Chaps. 2-4 Due: two weeks (Nov. 1, 2013)

Chap.1 1.8: What is the purpose of interrupts? How does an interrupt differ from a trap? Can traps be generated intentionally by a user program? If so, for what purpose?

Chap. 2 2.10: What is the main advantage of the microkernel approach to system design? How do user programs and system services interact in a microkernel architecture? What are the disadvantages of using the microkernel approach?

Chap. 3 3.1: Describe the differences among short-term, medium-term, and long-term scheduling.

3.14*: The Collatz conjecture concerns what happens when we take any positive integer n and apply the following algorithm: The conjecture states that when this algorithm is continually applied, all positive integers will eventually reach 1. For example, if n=35, the sequence is 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1 (…to be continued…)

Write a C program using the fork() system call that generates this sequence in the child process. The starting number will be provided from the command line. For example, if 8 is passed as a parameter on the command line, the child process will output 8, 4, 2, 1. Because the parent and child processes have their own copies of the data, it will be necessary for the child to output the sequence. Have the parent invoke the wait() call to wait for the child process to complete before exiting the program. Perform necessary error checking to ensure that a positive integer is passed on the command line.

3.15*: In Exercise 3.14, the child process must output the sequence of numbers generated from the algorithm specified by the Collatz conjecture because the parent and child have their own copies of the data. Another approach to designing this program is to establish a shared-memory object between the parent and child processes. This technique allows the child to write the contents of the sequence to the shared-memory object. The parent can then output the sequence when the child completes. Because the memory is shared, any changes the child makes will be reflected in the parent process as well. (… to be continued…)

This program will be structured using POSIX shared memory as described in Section 3.5.1. The parent process will progress through the following steps: (a) Establish the shared-memory object (shm_open(), ftruncate(), and mmap()). (b) Create the child process and wait for it to terminate. (c) Output the contents of shared memory. (d) Remove the shared-memory object. One area of concern with cooperating processes involves synchronization issues. In this exercise, the parent and child processes must be coordinated so that the parent does not output the sequence until the child finishes execution. These two processes will be synchronized using the wait() system call: the parent process will invoke wait(), which will suspend it until the child process exits.

Chap. 4 4.2: Under what circumstances does a multithreaded solution using multiple kernel threads provide better performance than a single-threaded solution on a single-processor system?

4. 19. : Write a multithreaded program that outputs prime numbers 4.19*: Write a multithreaded program that outputs prime numbers. This program should work as follows: The user will run the program and will enter a number on the command line. The program will then create a separate thread that outputs all the prime numbers less than or equal to the number entered by the user.

Homework Submission For hand-written exercises, please hand in your homework on papers in class For programming exercises, please upload your code to the program submission site as follows: URL: http://mslin.ee.ntut.edu.tw/ User account/Password: (your student ID) Please change your password as soon as possible Program uploading: a compressed file (in .zip format) including source codes and a compilation instruction if your program needs special environment or tool to compile or run Please clearly name your program files using your ID Note: the uploaded file size must be less than 5MB

More on Optional End-of-Chapter Projects Programming Project for Chap. 2: Linux Kernel Modules Creating kernel modules Kernel data structures Programming Project for Chap. 3: UNIX Shell and Tasks UNIX shell and history feature Linux kernel module for listing tasks Programming Project for Chap. 4: 1. Sudoku solution validator Passing parameters to each thread Returning results to the parent thread 2. Multithreaded sorting application

Thanks for Your Attention!