Processes (ITI8510): erinevus redaktsioonide vahel
Uus lehekülg: ''''We look at ways to execute a program''' The goal of the lab is to use three different programs to see how to execute programs. It's really simple this time. == Task == Writ...' |
Resümee puudub |
||
| (ei näidata sama kasutaja 4 vahepealset redaktsiooni) | |||
| 1. rida: | 1. rida: | ||
{{iti8510}} | |||
''We look at ways to execute a program'' | |||
The goal of the lab is to use three different programs to see how to execute programs. It's really simple this time. | The goal of the lab is to use three different programs to see how to execute programs. It's really simple this time. | ||
| 7. rida: | 8. rida: | ||
Write three programs. | Write three programs. | ||
First one -- execute -- runs the program "stopper" with argument "-s" from the same directory where it is located (use only exec()). | First one -- execute -- runs the program "stopper" (you can find it in the prototype below) with argument "-s" from the same directory where it is located (use only exec()). | ||
The second -- runner -- runs program "stopper" with argument "-s" from the same directory where it is located and waits for it to finish. After the program has concluded, it prints "runner: Stopped". (fork() + exec() + wait()) | The second -- runner -- runs program "stopper" with argument "-s" from the same directory where it is located and waits for it to finish. After the program has concluded, it prints "runner: Stopped". (fork() + exec() + wait()) | ||
Third program -- backgrounder -- runs the program "stopper" with an argument of "-s", but does not wait for it to conclude; it exits. This would be analogous to the Daemon pattern explained in the | Third program -- backgrounder -- runs the program "stopper" with an argument of "-s", but does not wait for it to conclude; it exits. This would be analogous to the Daemon pattern explained in the lecture. | ||
Backgrounder should print the PID of itself and the child when it runs. | Backgrounder should print the PID of itself and the child when it runs. | ||
| 19. rida: | 20. rida: | ||
== Prototype == | == Prototype == | ||
The prototype can be found at /export/ | The prototype can be found at /export/kursused/iti8510/ (or [http://dijkstra.cs.ttu.ee/iti8510/processes.tar.gz] ) | ||
To copy the file to the current directory: | To copy the file to the current directory: | ||
cp /export/ | cp /export/kursused/iti8510/processes.tar.gz . | ||
Untar it: | Untar it: | ||
tar -xzvf processes.tar.gz | tar -xzvf processes.tar.gz | ||
Viimane redaktsioon: 14. oktoober 2015, kell 11:04
| Real-Time Operating Systems and Systems Programming |
| [ @ ] |
We look at ways to execute a program
The goal of the lab is to use three different programs to see how to execute programs. It's really simple this time.
Task
Write three programs.
First one -- execute -- runs the program "stopper" (you can find it in the prototype below) with argument "-s" from the same directory where it is located (use only exec()).
The second -- runner -- runs program "stopper" with argument "-s" from the same directory where it is located and waits for it to finish. After the program has concluded, it prints "runner: Stopped". (fork() + exec() + wait())
Third program -- backgrounder -- runs the program "stopper" with an argument of "-s", but does not wait for it to conclude; it exits. This would be analogous to the Daemon pattern explained in the lecture.
Backgrounder should print the PID of itself and the child when it runs.
NB! If you want to compile only the first program, write "make stopper" or "make runner".
Prototype
The prototype can be found at /export/kursused/iti8510/ (or [1] ) To copy the file to the current directory:
cp /export/kursused/iti8510/processes.tar.gz .
Untar it:
tar -xzvf processes.tar.gz