Hack hack hack...

An open journal-- some of it written for you, but most of it is for me.

How Linux Works: What Every Superuser Should Know

Posix shell and Utilities

fork() & exec()

  • When running exec() programs, you are forking a shell and running it on that
  • Fork and exec
  • Why do shells call fork?
    • exec can only run one thing. So shell creates the child shell runs exec and then returns.
  • fork() clones the current process, creating an identical child. exec() loads a new program into the current process, replacing the existing one. From

Time slice

  • time slice#Time_slice) managed by the scheduler of the CPU. Time slices are variable -> need this to keep the illusion of concurrency(having multiple processes at the same time) and multi-tasking, but with one core there is no possibility of doing paralellism.

Builtins

  • (wikipedia)[https://en.wikipedia.org/wiki/Shell_builtin]
    • executed directly in the shell itself, instead of an external executable program which the shell would load and execute.
    • Shell builtins work significantly faster than external programs, because there is no program loading overhead.
    • most notable example is cd
    • cd has to be a builtin because the shell itself needs to change its “cwd” - current working directory - not a sub-process. The goal of “cd” is to change the current working directory of the shell itself, and that can’t be accomplished from a child process without a lot of special hackery which would end up being more complex than the builtin. from
      • great explanation on how it came to be with a quote from Dennis Ritchie

Memory Management

  • swap -> using the hard disk as RAM
  • A page table is the data structure used by a virtual memory system in a computer operating system to store the mapping between virtual addresses and physical addresses. Virtual addresses are used by the accessing process, while physical addresses are used by the hardware, or more specifically, by the RAM subsystem.

Tree

Comments