0% found this document useful (0 votes)
4 views

Homework Fork

The document describes a homework assignment involving analyzing and modifying a C program that uses processes and shared memory. The homework asks students to analyze how the original program works, including what each child process does and why the output changes. It also asks them to modify the program so the parent process creates a shared memory array and child processes increment values in this shared area.

Uploaded by

limonlukek1453
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Homework Fork

The document describes a homework assignment involving analyzing and modifying a C program that uses processes and shared memory. The homework asks students to analyze how the original program works, including what each child process does and why the output changes. It also asks them to modify the program so the parent process creates a shared memory array and child processes increment values in this shared area.

Uploaded by

limonlukek1453
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

ISTANBUL COMMERCE UNIVERSITY

Dept. Of Computer Engineering


BIL362 – Operating Systems
Spring’24
Homework 1

Part I (Code understanding):


Analyze the given C program and answer the questions below.

1. What will be the output of the program? Interpret the output and explain what each
child process does.
2. Run the program multiple times. You will see the output changes from time to time.
What is the reason? Explain.
3. Why does each child process increment values in a specific part of the array? How is
this part determined?
4. Why the parent process’ array does not change?
5. How does the parent process wait for all child processes to finish? Which system call
is used for this operation?
6. What does the parent process do while waiting for child processes to finish? Which
code block is executed during waiting?
7. Which system calls and functions are used in this program? Explain the purpose of
each.

Part II (Code generation):

Change the given program so that the parent process defines the integer array as a shared
memory area and the child processes attach to this memory area and performs increments
on this shared array. After the child processes complete, the parent process will print 1 2 3
4 5 6 7 8 9 10 to the screen as the output. Explain the program logis and the system calls
you make in this new program.

Note: You will not be graded with this homework, but you will be responsible at midterm
and final exams.

You might also like