Operating Systems 2017F Lecture 8: Difference between revisions

From Soma-notes
Rquaium (talk | contribs)
No edit summary
Akhil (talk | contribs)
No edit summary
Line 3: Line 3:
This class was review of older classes and answering questions (No new topics)  
This class was review of older classes and answering questions (No new topics)  


User mode: only mode available to us
Kernel: make a request for memory
Kernel: abstracts that, it provides you with the RAM you need to access by providing an address
What is a process: a running program


What is a program: set of the instructions, given to the CPU to execute line by line
User mode: only mode available to us as users.


Command line/sell/terminal: all same thing
Kernel: Abstracts hardware so we can use it. eg. we request memory, kernel handles the actual allocation, etc.
 
 
What is a process: a running program, set of the instructions, given to the CPU to execute line by line
 
Command line/shell/terminal: This is how we can interact with the OS without a desktop environment.


How do processes communicate with each other ?
How do processes communicate with each other ?
They send signals to each other. For example, parent knows that child has executed when it receives signal
They send signals to each other. eg. Child sends a signal to parent when it has finished execution.


PS: list of process
Orphan process: parent has finished executing and terminated, leaving an "orphaned" child process who's parent process will now be a process from a higher level (grandfather process).


Orphan process: parent has finished executing and terminated leaving an "orphaned" child process who parent process will become a process from a higher level
Zombie process: Process that has finished executing but its entry still exists in the process list. In this case, the parent is still up and running.


Zombie process: Process that has finished executing but its entry still exists in the process list (parent does not wait for child to terminate before it dies)


File system: managing the hard drive, writing and reading to a file etc.  
File system: managing/organizing the hard drive, control how data is stored/retrieved. Writing and reading from/to a file etc. examples of special files like /proc, etc.


Environment: where we are working
inode is a data structure in linux that is used to store file metadata information like size of file, timestamps, type of file, etc. (however, it does NOT store the name or actual data of the file).


Environment variable: is where configurations are stores, all start with “$” signs. To check resolutions etc. find any info like user etc.


Configurations are stored in an environment variable like $USER
Environment: where we are working.


$PATH stores list of all folders that tells shells where to look for
Environment variable: is where configurations/information about the system/current environment are stored. eg. username, type of terminal being used, prompt, etc.


envp[] stores all environment variables
"echo $USER" in terminal to check the value of "user" environment variable.


Data structure stores data. Inode is a datastructure on a filesystem in linux that is used to store file information (however, it does NOT store the name or actual data of the file).


File system Device files stored in /dev
Difference between static and dynamic compilation:


Path: List of all folder into which the shell looks at to find a program if not giving it a full path . “looking for the path to find a program we want to run”.
Dynamically linked file: loads code from libraries as it needed.
Memory is not continuous
Everything is linux is a file ,
Difference between static and dynamic compilation:


Dynamically linked file: loads code as it needs it
Libraries are dynamically loaded into memory versus when they are loaded statically.


Libraries are dynamically loaded into memory versus when they are loaded statically
Statically linked file: loads relevant code into the binary during compilation so no library calls are made during runtime. This is why ltrace gives error.


Man pages are helpful…


Commands:
Commands:
LSPCI: shows you which hardware you are working with  
lspci: shows you which hardware you are working with
Ps : to find a process ID , coming from the kernel
Ps – aux
Pstree: displayes the family tree . systemd : first one , always wait on the child and checks if the child has to report something to prevent zombie processes.
SIGCHILD : how processes communicate , they send signals to communicate with each other and SIGCHILD is one of them
A child send it to the parent when it is done its task.
 
X clock & : generates a clock ?
How to redirect a file into a text file?


ps aux | grep xclock > ps.log
ps : to find a process ID , coming from the kernel
 
 
Generate a file on a strace on a program: we should know the command line to do this
ps – aux
 
 
Echo $USER : to identify user name
pstree: displayes the family tree
Envp[] : stores all the env variables you have
 
/proc/ 1237 ls
systemd : first one , always wait on the child and checks if the child has to report something to prevent zombie processes.
/proc/1237$
 
Man man
Man pages are helpful…
Man readlink : shell command , also a system call
"Man man" for more information
Xclock ; is the child of the bash terminal
(Do a while loop or a for loop to parse it )
^ /proc/2363 status? The you get the RAM and all info about the process
 

Revision as of 01:16, 9 October 2017

Notes

This class was review of older classes and answering questions (No new topics)


User mode: only mode available to us as users.

Kernel: Abstracts hardware so we can use it. eg. we request memory, kernel handles the actual allocation, etc.


What is a process: a running program, set of the instructions, given to the CPU to execute line by line

Command line/shell/terminal: This is how we can interact with the OS without a desktop environment.

How do processes communicate with each other ? They send signals to each other. eg. Child sends a signal to parent when it has finished execution.

Orphan process: parent has finished executing and terminated, leaving an "orphaned" child process who's parent process will now be a process from a higher level (grandfather process).

Zombie process: Process that has finished executing but its entry still exists in the process list. In this case, the parent is still up and running.


File system: managing/organizing the hard drive, control how data is stored/retrieved. Writing and reading from/to a file etc. examples of special files like /proc, etc.

inode is a data structure in linux that is used to store file metadata information like size of file, timestamps, type of file, etc. (however, it does NOT store the name or actual data of the file).


Environment: where we are working.

Environment variable: is where configurations/information about the system/current environment are stored. eg. username, type of terminal being used, prompt, etc.

"echo $USER" in terminal to check the value of "user" environment variable.


Difference between static and dynamic compilation:

Dynamically linked file: loads code from libraries as it needed.

Libraries are dynamically loaded into memory versus when they are loaded statically.

Statically linked file: loads relevant code into the binary during compilation so no library calls are made during runtime. This is why ltrace gives error.


Commands: lspci: shows you which hardware you are working with

ps : to find a process ID , coming from the kernel

ps – aux

pstree: displayes the family tree

systemd : first one , always wait on the child and checks if the child has to report something to prevent zombie processes.

Man pages are helpful… "Man man" for more information