Architecture Flashcards
What is parameter expansion?
$home = /home/jeroen
what is $IFS
Internal field seperator, IFS=$ā\nā will separate based on new line
What system call does strace use?
ptrace system call
Show strace command
strace -e trace=process <>
What does stat do?
Searches for command in file system
Show stat command
int stat(const char *pathname, struct stat *buf)
What does the shell do to survive before execve
It does a fork
What does fork do
Creates a new process which becomes the child
What is the fork command
pid_t fork(void)
What are better alternatives than regular fork
clone and vfork
Why is fork inefficient?
Lots of copying
Command for vfork?
pid_t vfork(void)
Command for clone?
long clone(unsigned long flags, ..)
Who executes execve and after what?
The child. The parent first issues a fork
Show the execve command
int execve(const char *filename, char *argv[], char envp[]);
What happens when you forget to wait
Creates zombies
What happens when you exit before child finishes
Creates orphans
Name the executable file formats
a.out = assembler format. COFF = common object file format. PE = portable executable. ELF = executable and linkable format
What is the first line in script
Used for interpreter (#!/bin/bash). Must be an absolute path
What does /proc provide?
Interface to kernel data
What are the gcc stages
Preprocessing, Compilation, Assembly, linking
What does the kernel supply on startup
Special shared object vDSO (virtual dynamic shared object)
Operations of CPU
Fetch, Decode, Execute
What is segmentation
Translates logical address into linear address
What is paging
Translates a linear address into a physical address