SRE Flashcards
What is difference between process and thread?
A thread is a lightweight process. Each process has a separate stack, text, data and heap. Threads have their own stack, but share text, data and heap with the process. Text is the actual program itself, data is the input to the program and heap is the memory which stores files, locks, sockets
What is a zombie process
A zombie process is a one which has completed execution, however it’s entry is still in the process table to allow the parent to read the child’s exit status. The reason the process is a zombie is because it is “dead” but not yet “reaped” by it’s parent. Parent processes normally issue the wait system call to read the child’s exit status whereupon the zombie is removed. The kill command does not work on zombie process. When a child dies the parent receives a SIGCHLD signal
How do you end up with zombie processes?
Zombie processes are created when the parent does not reap the child. This can happen due to parent not executing the wait() system call after forking.
Describe ways of process inter-communication
POSIX mmap, message queues, semaphores Shared memory Anonymous (unnamed) pipes and named pipes Unix domain sockets signals
Describe how processes executes in a Unix shell
Let’s take the example of /bin/ls. When run ‘ls’ the shell searches in it’s path for an executable named ‘ls, when it finds it, the shell will forks off a copy of itself using the fork system call. If the fork succeeds, then in the child process the shell will run ‘exec /bin/ls’ which will replace the copy of the child shell with itself. Any parameters that that are passed to ‘ls’ are done so by exec.
What are unix signals?
Signals are an inter process communication method. The default signal in Linux is SIG-TERM. SIG-KILL cannot be ignored and causes an application to be forcefully killed. Use the ‘kill’ command to send signals to a process. Another popular signal is the ‘HUP’ signal which is used to ‘reset’ or ‘hang up’ applications
When you send a HUP signal to a process, you notice that it has no impact, what could have happened?
During critical section execution, some processes can setup signal blocking. The system call to mask signals is ‘sigprocmask’. When the kernel raises a blocked signal, it is not delivered. Such signals are called pending. When a pending signal is unblocked, the kernel passes it off to the process to handle. It is possible that the process was masking SIGHUP
MyISAM vs InnoDB storage engines
- MyISAM will out-perform InnoDB on large tables that require vastly more read activity versus write activity.
- MyISAM’s readabilities outshine InnoDB because locking the entire table is quicker than figuring out which rows are locked in the table. The more information in the table, the more time it takes InnoDB to figure out which ones are not accessible.
- If your application relies on huge tables that do not change data frequently, then MyISAM will out-perform InnoDB.
- Conversely, InnoDB outperforms MyISAM when data within the table changes frequently. Table changes write data more than reading data per second. In these situations, InnoDB can keep up with large amounts of requests easier than locking the entire table for each one.
Describe a situation in which you had to solve a critical issue
Hardware testing thermal issues on a new server platform
What is race condition
2 or more operations try to execute at the same time, but should be performed in a specific sequence. (use stress/load testing)
How do you debug a core
Use a tool like gdb
GDB, the GNU Project debugger, allows you to see what is going on `inside’ another program while it executes – or what another program was doing at the moment it crashed.