Professional Documents
Culture Documents
Linux File System, Paths, Memory and Compiltation Process
Linux File System, Paths, Memory and Compiltation Process
memory
Ing. Marco Andrés Ortiz N. MSc
Linux Filesystem Hierarchy Standard (FHS)
• Defines the directory structure and contents
• Maintained by the Linux Foundation
(https://www.youtube.com/watch?v=b55rd3fEYDE)
• Evolution of FHS
• Not used
• 1994: V1.0, V1.1 FSSTND (File System Standard)
• 1995: V1.2 FSSTND (File System Standard)
• 1997: V2.0 FHS
• 2000: v2.1 FHS
• 2001: v2.2 FHS
• https://refspecs.linuxfoundation.org/fhs.shtml
• Still Maintained FHS 2.3 released January 29, 2004.
• Latest version FHS 3.0 released June 3, 2015
Linux Filesystem Hierarchy Standard (FHS)
Required
[1]
Linux Filesystem Hierarchy Standard (FHS)
Required
[1]
Linux Filesystem Hierarchy Standard (FHS)
Optional
[1]
• Activity 1
• Go to the FHS Version 3.0 Standard document
• Compare: /bin vs /sbin commands
• In Linux:
• Identify these directories and their commands within
• See O.S version, Memory and CPU information from /proc
Paths
• Relative Paths: Relative to current working
directory
• ./ Represents current working directory.
• ../ Represents the parent directory.
• Absolute Paths
• specifying the location of a file or directory from the
root directory (/).
Later in ALSE:
• Activity 3: Process Control:
fork, exec, and waitpid
• Identify Linux PIDs with top and ps commands
• Generate a custom process and see its PID
Process Environment
• A C program starts execution when main function called Activity 4: main
arguments example
Process 2
Process 1
System libraries
Kernel
• Automatic variables: Without the static keyword, any variable inside a function is
automatic. (Local to function)
• Static variables: Exist in the same place throughout the life of the program. Variables
declared outside of functions (in file scope) and inside functions with the static
keyword. Array sizes are fixed at startup, but values can change. Initialized to all zeros
(or NULL) when no other initialization. any initializations must be done with
constants that require no calculations.
• Manual variables: malloc and free. The only type of memory where arrays can be
resized after declaration.
Ben Klemens - 21st Century C_ C Tips from the New School-O'Reilly Media (2014)
Memory of a C Program
Ben Klemens - 21st Century C_ C Tips from the New School-O'Reilly Media (2014)
Memory of a C Program
• Activity 5:
• With a basic C program example, use the following commands to identify
memory behavior:
• size --format=Berkeley
• size --format=SysV
• objdump –s
References
• [1] LSB Workgroup, The Linux Foundation. Filesystem Hierarchy Standard.
Version 3.0. March 19, 2015
• [2] https://www.geeksforgeeks.org/absolute-relative-pathnames-unix/
accesed: 9/19/2021
• [3] Stevens, W. Rago S. Advanced Programming in the UNIX® Environment
Third Edition. Addison-Wesley. 2013
• [4] Ben Klemens - 21st Century C_ C Tips from the New School-O'Reilly
Media (2014)
• Other sites:
• https://www.youtube.com/watch?v=_8-ht2AKyH4
• https://www.geeksforgeeks.org/memory-layout-of-c-program/