Questions and Answers
What does the exec() system call do in the process lifecycle?
The process returns to user mode after calling a system call.
True
What is created when a file is opened through the open() system call?
An inode
The standard library for C programming language is called ______.
Signup and view all the answers
Match the following file operations with their corresponding actions:
Signup and view all the answers
Which of the following describes the purpose of shared libraries?
Signup and view all the answers
The write() system call switches the process to user mode.
Signup and view all the answers
What is the initial mode when a process is created?
Signup and view all the answers
What is the main purpose of lazy binding in operating systems?
Signup and view all the answers
Lazy binding resolves the address of a function at compile time.
Signup and view all the answers
What happens when a function is called using lazy binding for the first time?
Signup and view all the answers
In lazy binding, the initial call to a shared function points to the _________ resolver code.
Signup and view all the answers
Match the following components of lazy binding with their roles:
Signup and view all the answers
Which of the following statements about shared libraries is true?
Signup and view all the answers
The Global Offset Table (GOT) maintains the default addresses of all functions in shared libraries.
Signup and view all the answers
Describe the role of the Global Offset Table (GOT) in lazy binding.
Signup and view all the answers
The performing of _________ minimizes the need to recompile code each time a library is updated.
Signup and view all the answers
What does the process of deferred binding primarily enhance?
Signup and view all the answers
What is the main advantage of using shared libraries?
Signup and view all the answers
Shared libraries are fixed in memory addresses across different processes.
Signup and view all the answers
What is the role of the dynamic linker in relation to shared libraries?
Signup and view all the answers
Shared libraries are shared among all processes using them through __________.
Signup and view all the answers
Match the following functions with their respective roles in the context of shared libraries:
Signup and view all the answers
When does the dynamic linker resolve the address of a shared function?
Signup and view all the answers
Static linking improves memory usage compared to shared libraries.
Signup and view all the answers
What is the first action taken by an executable in UNIX systems using ELF format?
Signup and view all the answers
The dynamic linker is tasked with __________ shared libraries needed by the program.
Signup and view all the answers
Which of the following statements is true regarding shared libraries?
Signup and view all the answers
What does a process control block (PCB) represent in an operating system kernel?
Signup and view all the answers
The system call kill() can be used to send a signal to terminate processes.
Signup and view all the answers
What is the purpose of shared libraries in an operating system?
Signup and view all the answers
In process communication, a process can send a signal using the system call kill() with the argument _____ for stopping the process.
Signup and view all the answers
Match the following terms with their descriptions:
Signup and view all the answers
What does the Procedure Linkage Table (PLT) contain?
Signup and view all the answers
Lazy binding resolves all relocations when the program starts.
Signup and view all the answers
What is the purpose of the Global Offset Table (GOT)?
Signup and view all the answers
Eager binding also known as __________ binding, resolves all relocations when the program starts.
Signup and view all the answers
Match the following components with their descriptions:
Signup and view all the answers
Which of the following strategies requires restructuring the GOT during program start?
Signup and view all the answers
The dynamic linker typically uses information in the ELF header for linking operations.
Signup and view all the answers
What information does the ELF header primarily provide for linking operations?
Signup and view all the answers
When a shared library function is called, it jumps to the corresponding ______ entry that directs it to the address in the GOT.
Signup and view all the answers
Which of the following best describes the initial action of the dynamic linker?
Signup and view all the answers
Study Notes
File Manipulation Process
- Process creation involves forking from a parent process, copying its PCB.
- The
exec()
system call is used to replace the current process image with a new program. - Default file descriptors opened are stdin, stdout, and stderr.
- The
open()
system call is made to access "foo.txt" in write-only mode, transitioning to supervisor mode. - An inode is created which allocates necessary blocks on the device.
- A file descriptor pointing to the inode is formed, initialized with mode and offset 0, and linked to the file table in the PCB.
- Following the write operation through
write()
, the kernel accesses the file descriptor and locates the appropriate block for data writing.
Shared Libraries
- Shared libraries prevent code duplication in memory by allowing multiple programs to use the same library simultaneously.
- Libraries like libc for C are common, where static linking would lead to wasted memory across multiple binaries.
- Memory mappings (via
mmap()
) facilitate shared usage of libraries.
Function Resolution in Shared Libraries
- The address of a shared function can differ across processes due to individual mappings in their virtual address spaces.
- Dynamic linkers facilitate the loading and linking of shared libraries and functions at runtime, not at compile time.
Dynamic Linker Operations
- The dynamic linker is essential for loading the binary into memory, setting up the memory layout, and loading necessary shared libraries during program execution.
- Example shows how a program using
printf()
translates to assembly code that accesses a shared library.
Lazy Binding
- Lazy binding resolves function addresses only upon the first call, utilizing the Procedure Linkage Table (PLT) and the Global Offset Table (GOT).
- The initial call routes through the relocation resolver, which updates the GOT for subsequent calls to directly access the correct function address.
- Linking operations rely on ELF header information, identifying necessary symbols and relocation data.
Eager Binding
- Eager binding resolves all relocations when a program starts, modifying entries in the GOT for functions and variables.
- On function calls, the program jumps to the corresponding entry in PLT leading directly to the address in the GOT.
User-Kernel Interactions
- A process is defined within the kernel by its process control block (PCB).
- User-space programs interact with the kernel through integer values for system calls, virtual addresses for memory management, and file descriptor tables for file operations.
Signal Handling Example
- Process 1 can send a STOP signal to process 2 using the
kill()
system call, which involves transitioning to supervisor mode and setting appropriate bits in the pending signals of process 2.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Explore the fundamental concepts of operating systems and file manipulation through a detailed example of process creation and management. This quiz assesses your understanding of how processes interact with files and the system. Test your knowledge of these essential software components.