CMSC 421 Exam 1(Correctly solved)
What is the name of our instructor? correct answers Gerald Tompkins What is the email of our instructor? correct answers What does the fork system call do? correct answers The operating system will create a new process that contains the same code/data as the parent process. The state is copied, including open files, register state and all memory allocations, which include the program code. Has a new program ID What does the exec system call do? correct answers Used when the process is not part of the same program as parent process. This is the case in the shell; when a user starts the command, it needs to run in a new process, but it is unrelated to the shell. Called after a fork. The exec replaces forked process with the new process. Since it replaces forked process, it has the same PID as the old process. How does fork and exec work together? correct answers While they have two different purposes, they work together. The fork() system call creates an exact copy of a program while the exec() system call replaces an instance of a program. So, if you want to have another program run at the same time, you can fork a current process to create a new instance, and then exec() in that fork to get a different program to run. This allows two things to run at the same time even if you only explicitly ran one thing. What is a system call in C programming? correct answers A system call is a programming interface to the services provided by the OS kernel. Mostly accessed by programs in a high-level API. What is a stack? correct answers LIFO Structure, Used for temporary data, function arguments, local variables, and return addresses. Automatically allocated and deallocated upon function entry/exit. What is a heap? correct answers Dynamically allocated blocks. Used for dynamically allocated data with unknown size beforehand. What is a text? correct answers Read-only segment containing the program's executable code. Fixed size set during program compilation/linking. Not managed during runtime, cannot be modified. What is "data"? correct answers Contains global and static variables initialized before program execution. Fixed size set during program compilation/linking. Initialized values can be modified during runtime.
Información del documento
- Subido en
- 23 de mayo de 2024
- Número de páginas
- 3
- Escrito en
- 2023/2024
- Tipo
- Examen
- Contiene
- Preguntas y respuestas