Arch: Software Basics - rFronteddu/general_wiki GitHub Wiki

A program is a set of computer instructions that perform a particular task. C is a machine independent language that compilers can read and translate into assembly language, generating machine specific code. C code is organize into routines, each of which perform a task. Large programs comprise many separate source modules each with its own routines and data structures. A variable is a location in memory which can be referenced by a symbolic name. The linker (see below) worries about where to put variables in memory. Pointers are variables that contain the address, the location in memory of other data. C allows you to bundle together related variables into structures.

Linkers

Linkers are programs that link together several object modules and libraries to form a single, coherent, program. Object modules (one could be the logic of a DB, the other the CLI code, etc) are the machine code output from an assembler or compiler and contain executable machine code and data together with information that allows the linker to combine the modules together to form a program.

OS

An Operative System is a set of cooperating set of functions that together give the user a coherent view of the system.

Memory Management

The OS make a small amount of physical memory behave like rather more memory. This apparently large memory is known as virtual memory. The system divides the memory into easily handled pages and swaps these pages onto a HD as the system runs. The SW does not notice because of multi-processing.

Processes

A process could be thought of as a program in action, each process is a separate entity that is running a particular program. If my system had many CPUs then each process could (theoretically at least) run on a different CPU. Since there are more processes than CPU, the OS run each process for a short period of time known as time-slice. Processes are isolated from one another so that if one crashes it will not affect any other. The OS achieves this by giving each process a separate address space which only they have access to.

The Filesystem

In unix, the separate filesystems that the system may use ar not accessed by device identifiers but are combined into a single hierarchical tree structure that represents the filesystem as a single entity. Linux adds each new filesystem into this tree as they are mounted onto a mount directory. EXT2 is the most popular filesystem for linux.

Kernel Data Structures

Caches are handy information that needs to be accessed quickly and are usually a subset of the full set of information available. Data structures are put into a cache and kept there because the kernel often accesses them. There is a drawback to caches in that they are more complex to use and maintain than simple linked lists or hash tables. If the data structure can be found in the cache (this is known as a cache hit, then all well and good. If it cannot then all of the relevant data structures must be searched and, if the data structure exists at all, it must be added into the cache. In adding new data structures into the cache an old cache entry may need discarding. Linux must decide which one to discard, the danger being that the discarded data structure may be the next one that Linux needs.