Unix
Unix
Operating Systems
Operating Systems
The operating system works as the primary interface between a human and their computer
This has taken various forms over the years, but there are several primary duties:
Oversee operations of a computer and its devices
Drivers work as an interface between the hardware and software
Store and retrieve files
File System
Schedule programs for execution
Coordinate the execution of programs
Processing
Batch Processing
Job queuing
Interactive Processing
Programs with input and output
Multiprocessing/Multithreading
Multiple processes working with shared data
Web Operating Systems
Batch Processing
The simplest form of processing
Batch processing is essentially a series of scheduled programs that require no external influence
Jobs are queued, executed and results rendered
Jobs – Program, data and directions
Job Queue
User Domain
Job Execution
Results!
Machine Domain
Interactive Processing
Many programs are interactive in nature
In fact most of the software we as users see on a daily basis are interactive
But there’s a lot of processes that are hidden from us just plugging away in batches
Interactive programs require some for of user interaction to accomplish goals that the user sets forth
User Domain
Programs
Data, Directions, Results
Program Execution
Machine Domain
Shared Computing
Multiprocessing or Multithreading
These share resources and are used to run complex programs
Sometimes this is just to save time and effort
Eager evaluation, complex calculations
Sometimes this is to allow programs to “walk and chew gum”
Networking, etc.
Lots of problems can arise from sharing resources
Concurrency errors, race conditions, etc.
Software Classification
Software
Applications
Office
Web
System
Games
Etc.
Compilers
Antivirus
Defrag
Utility
Operating System
Shell
Device Managers
Kernel
Process Manager
Memory Manager
File Manager
etc.
Changing World
Mobile computing and Web 3.0 is changing how we compute
The desktop computing world is pretty much the same picture
Microsoft dominates with 91% of the market share
6% is Mac
Mobile Computing however paints an interesting picture
63% Andoird
33% iOS
And only about 2% shared by everything else
According to www.similarweb.com – Mobile now drives 56% of all web-traffic!
However, desktop users spend more time on websites
https://www.netmarketshare.com/operating-system-market-share.aspx?qprid=8&qpcustomd=0
https://www.stonetemple.com/mobile-vs-desktop-usage-mobile-grows-but-desktop-still-a-big-player/
History of Unix
Before we get into details … let’s understand one of our tools…
Unix
UNIX is an old operating system that has been kept alive for a long time and continues to impact modern computing
What’s so great about it?
At face value:
UNIX has several FREE varieties
UNIX has several Open Source varieties
Deeper – Unix is often on the front lines of
Cloud computing
Security
Virtualization
And more…
It is more customizable to certain tasks than something like a Windows which is more for daily use
History
Created in AT&T Bell Labs in the 60’s by Ken Thompson, Dennis Ritchie and others
Both of these guys are computer science GIANTS
Dennis Ritchie invented the C programming language
Broke M-209 US Encryption in the 70’s
Ken Thompson invented B … the direct predecessor to Richie’s C
Developed UTF-8
Go Programming Language
A world champion chess computer
Considered by some to be the father of open source
Unix was re-written in 1973 using C
This is huge …
History
Due to UNIX being re-written in C, the operating system became Portable
The O/S could be rewritten for new hardware configurations and new machines
This simple step allowed for UNIX to become what it is today rather than a simple footnote in the journey of Computer Science
Another thing that happens is that UNIX is (at first) open and free
1979 – V7 was released – V7 would be come the ‘grandfather’ of all UNIX operating systems
History – Closing what was open and opening what was closed… Three factures …
In the early AT&T decided to close UNIX and begin marketing licenses
There’s money to be made right? … Oh well …
However, Berkley led the academic community in developing the BSD (Berkley Software Distribution) version of Linux
This led to the “Unix Wars” as two major strains of UNIX now existed in the public consciousness
Commercially AT&T’s System V wins the ‘standards war’
This means that hardware vendors adopt System V for development of drivers and so on
System V ended up absorbing many of BSD’s innovations resulting in a merging of the two branches
BSD continued in academic and research circles
But there were other fractures as well …
History – GNU
In 1983 another player entered the scene … GNU
GNU’s Not Unix
So… um how did this all happen?
Well one day in the early 80’s Richard Stallman’s printer stopped working…
The manufacturer refused to give him source code so he could fix it …
So he did the next logical step … made his own version of the UNIX operating system
GNU
Stallman created the idea of “copyleft” – software that was free from copyright to be used, edited and distributed by anyone who wanted to
GNU never completed a functional kernel though
In 1991 another open source pioneer Linus Torvald would develop a unix kernel and merged it with Stallman’s GNU to make a fully functional complete Operating System called Linux
GNU Linux would become the most widely adopted OS
Other things that GNU brought
gcc/g++ – C and C++ compilers
gdb – GNU Debugger
emacs – text editor
and many many more
Keeping Score
UNIX – Licensed
Originally AT&T now Open Group
“The worldwide Single UNIX Specifiction”
GNU/Linux
Similar to UNIX but not derived from UNIX
Intentionally Unix-like
Widely adopted, many variations
Open source/Free
Red Hat – proprietary distribution of Linux
Fedora – open source version
BSD
Unix derivative
Proprietary and Open variants
Fed Unix variants such as SunOS
Contributed to Windows NT (net code)
Foundation to macOS and iOS
Other major players
BASH – Bourne-again shell – UNIX shell written by Brian Fox for GNU, widely used in Linux
Ubuntu – 2004 – Modern open source and most popular Linux distribution (40 millions desktop users as of 2015)
GNOME – 1999 – GNU Network Object Model Environment – a major Graphical User Interface development for Linux
Generally used or is the foundation for most Linux variants such as Red-Hat
Developed several core applications to make Linux more user friendly
Want to make your own?
Since there are many open varieties of Unix, Linux and BSD, you can make your own O/S if you want..
Just head on to your favorite distribution and go …
Yocto – And open source collaboration project to provide templates, tools and methods to create custom Linux systems for embedded products regardless of hardware
Yocto Project Sponsors:
Operating Systems
Components and Functions
Basic Components
Shell
The shell communicates with the user
This is frequently a command line/text based interface
DOS, BASH, etc.
Graphical User Interfaces were initially built over the top
Windows 3.1, 95
Now GUI’s are their own shell
Kernel
The guts of the O/S which make up the non-replacaeble portion of the O/S
File manager
Memory manager
Scheduler and Dispatcher
Device Managers
The replaceable guts of the O/S
Drivers that can be changed by the user
Shell
The shell makes up the interface between the user and the operating system and is considered the outermost layer of the operating system
It prompts the user for input and interprets that input for the OS
It then returns any output back to the user
The shell consists of a programming language to facilitate these communications, meaning that we can script within it to execute behaviors within the OS
In Linus we will use BASH
DOS uses BATCH
Shell – GUI
Middleware – Interfaces
Managers – Drivers
Kernel
Applications
The Kernel
The kernel consists of multiple managers that make up the ‘guts’ of the O/S
Key Components
Memory Management
File Management
Device management
Schedule and Dispatch
Memory Management
Pretty soon to be your “Best Friend” when working with C/C++
The Memory Manager maintains RAM allocation for programs to work within
When a program starts the Kernel will assign appropriate memory for the program
Static Memory – Static and global variables
Stack Memory – Local and non-static variables
Heap Memory – Dynamic allocation
We will be working with all three in C/C++
Memory Manager
The manager is constantly controlling the flow of information from slower memory locations to faster memory locations
(slowest) Disk -> RAM -> Cache -> Register (fastest)
As memory is needed the manager shuffles things into place loading form permanent storage if need be
Most of the time it’s working the pipeline between RAM and Register
Memory Manager
The memory manager does a lot of work behind the scenes.
We have a lot of control with powerful languages like C/C++ and low level languages, but the memory manager ultimately does the work
The memory manager doesn’t just control RAM it can also control Virtual Memory
Virtual memory is a way for the memory manager to make it seem like there’s more RAM then there actually is
By isolating some memory on the hard-drive the manager plays a “shell game” with the hard-drive and RAM
Pages (blocks of data) are shifted back and forth between RAM and the disk
File Manager
AKA the File System
Did you know … Bill Gates himself wrote the file system used in early windows?
FAT was written by Bill Gates
Apparently he wrote the code on an airplane and the complaint “I wrote FAT on an airplane” was a favorite of his when he wanted to complain about other people’s work
https://blogs.msdn.microsoft.com/oldnewthing/20131008-00/?p=3003
FAT would drive windows with new versions
FAT12, FAT16, FAT32
Eventually replaced by NTFS
File System
The role of the file system is to facilitate the storage and retrieval of information
It is usually built in two or three layers:
Logical File System
Interacts with an application and provides the API for file operations
Open, Close, Read, Write, etc.
Virtual File System
An interface that allows for concurrent instances of the physical file system
Physical File System
This layer works with the physical operation of the storage device
Buffering, memory management, actual placement of memory
Interacts with device drivers
File System
The File System is responsible for the organization of the files in permanent storage
As such it needs some organization and methods to access and allocate that storage
The file system maintains the Directory (or Folder) that information is stored in.
The directory gives the user a logical structure for managing their fiels
Each directory/folder has a Path which describes it’s full organizational structure
File System
The File System manages different types of files
“Ordinary Files”
These are the files created by the user and software
They consist of useful data: text, byte data, executables, etc.
The user can add, modify, delete, etc.
Directory Files
These contain lists of file names and other information related to those files
Device files/Special files
These represent physical devices like disks, networks, etc.
Character Special Files – data is handled character by character (printers, terminals, etc.)
Block Special Files – data is handled in blocks (disks, etc.)
File System – Space Management
Files are allocated space by the operating system and organized by it
Allocation Methods:
Contiguous
Each file occupies a contiguous address on the disk
Each address is assigned in linear order
Easy to implement
Fragments easily causing wasted space and slow access times
Linked
Each file contains a list of links to disk blocks
This is similar to a linked list where allocation is “wherever it fits” and pointer links keep the structure together
Can be inefficient especially in direct file access
Indexed
Creates a table/index block of pointers to files … think “card catalog”
Each file has its own index block which stores the addresses of the disk space occupied by the file
This is the most robust and used by modern O/S
Indexed File System Pipeline
filename
Index Table
Specific Location
Indices for parts
Part 1
Part 2
Part 3
Part 4
Part 5
Part 6
File System – File Access
Files aren’t necessarily accessed the same way
Depending on what we’re doing we might need to do things other than simply reading a file a chunk at a time
Method:
Sequential
“the default” read the file in order chunk by chunk
Direct/Random
Data chunks (records) are assigned their own addresses
Each record is accessed directly via these addresses
Records don’t need to be adjacent or even in any sequence
Indexed
A bit of both
An index is created for each file with pointers to blocks
The index is searched sequentially
Pointers allow for direct access to records
Booting up
The Bootstrap (where we get the term boot) is a program in the ROM (Read Only Memory) of the computer
When the CPU is powered on the Bootstrap is run automatically
It transfers the Operating System from storage into RAM
Then it executes the Operating System which begins and continues the boot up process
Early windows ran on top of DOS which meant you essentially had an OS on top of an OS.
Back then DOS did a good amount of the heavy lifting
I still remember having to type the win.exe into the prompt to start Windows
Booting
Program vs. Process
A program is a set of instructions that is stored on the disk and accessed through the file system
We will be writing programs this term
High Level Instructions Compile Low Level Instructions (exe)
A Process is a program loaded into memory that is in execution
It has a process state
Program Counter (what instruction is to be executed next)
Register Values (what’s in the registers?)
Related main memory contents
Multitasking
Operating Systems (especially modern ones) have built in controls for multi-tasking
Multi-threading
Multi-processing
The OS has a scheduler which schedules which process will receive CPU time next and dispatcher which controls the state of each process
The dispatcher controls the time slices that each process receives and shifts the processes between their states
Virtual Machine
Some of the operating system can be abstracted into a “ride-along” executable that can manage its own programs and processes
The Java Virtual Machine is a “machine” that runs within an OS that manages the execution of Java
The JVM receives execution time from the O/S
It acts as its own O/S for the sake of the Byte Code executing within it
The JVM acts and interacts directly with the O/S to run as fast as possible
The JVM does its own thread scheduling and RAM management
This allows it to maximize the portability of Java Code!
Multitasking – Issues
Multitasking comes with inherent issues
Concurrency problems
Two processes/threads making use of the same data override each-other and introduce inconstancies or errors
Race Conditions
Two or more processes/thread competing for the same data or other resources
Faster processes crowd out slower ones
Slow producers or consumers create bottle necks
Deadlock
Two or more processes/threads have competing actions and have blocked eachother from completion
A needs what B has to finish
B needs what A has to finish
Neither will ‘let go’ until it has finished
Multitasking Issues
Each issue can be solved through different means
Concurrency and Race Condition issues are often solved through “spin locks”
The shared resource is locked until a process/thread is done with their task
Prevents others from introducing problems and errors
Think of traffic lights controlling the flow of traffic
We can also avoid it by coding better algorithms and anticipating when deadlock may occur or to recover when it has occurred
This usually takes practice and a good amount of experience
It can be harder to catch deadlock then the other issues
Unix/Linux
Let’s learn to use this O/S
Subscribing
ASU maintains a Linux server that students can access
This is free for students through the ASU Technology Office (UTO)
Subscribe at:
www.asu.edu/selfsub
Sign in with your ASU ID
Subscribe to General/Statistics Unix Cluster
general.asu.edu
SSH
SSH stands for Secure Socket Shell
It is a network protocol that allows access to remote computers
Generally speaking it is an entirely command line environment
This makes it fine for working with Linux/Unix
You can access any and all tools available through the command line interface
I recommend getting a client that has color built in
The recommended client for this class is Putty
www.putty.org
There are other clients available out there that provide different tools and capabilities. Putty is a solid place to start though.
Putty
You can navigate to the download link from www.putty.org
Or go here: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
I would recommend downloading the putty.zip
It contains all the putty tools
In particular the psftp.exe which is a simple ftp tool for transferring files
Download the version right for your system
When all else fails … default to the 32bit version
Putty
When you run putty you’ll be greeted with this terrifying dialog box
This is where you set up and make the connection to the server
All we really have to do here is type in the address for the server and hit “Open” at the botrom
The server address is:
general.asu.edu
SSH
Now you log in with your ASU credentials
This will take you to your default directory
NOTE:
The password is entirely hidden, so it might seem like you nothing is happening, but it is
Let’s do this…
Time to get your hands dirty and delve into the command line environment
It’s going to be weird and you’re going to have to remember a lot of stuff
What have we just done?
We are now working within the BASH the command line shell of Linux
Which means it’s time to get used to how things work around here
This is a command line environment, so we have to get used to not having the convenience of the GUI
Organization
Unix/Linux is organized slightly different than windows
The directory structure looks very similar, but the OS itself is structured differently
In Linux directories are organized as a rooted tree
The root director is simply named “/”
The “root user” is the super user of the Unix system
This is similar to having Admin privileges in Windows, but arguably more powerful
NO you will not have root access to the Unix/Linux server
Structure of general.asu.edu
This is the user directories where your
work will be created/used
sbin is system binaries
bin is binaries
/
dev
lib64
sbin
bin
root
afs
home
usr
etc…
core
cpu
disk
input
log
mapper
net
ramdisk
stderr
stdout
accton
addpart
agetty
alsactl
arp
arping
audispd
… etc …
arch arch
cat
chmod
cp
cut
echo echo
kill kill
ls
mkdirmkdir
mv
pwd
rm
… etc …
asu.edu
others
users
abc…
abc…
abc…
include
others
Paths
Each directory/file has a path that exists from the root
/afs/asu.edu/users/s/a/m/sample1/
The path is the list of successive directory names from the root to where you are
When you refer to a file you often need to prefix the file with the path
If you’ve done File I/O in java, you’re probably used to this
An absolute path starts from the root directory and is given in full
A relative path starts from your current directory and uses certain operators to change where you’re currently looking
Relative Path Operators
We’re going to use this as our sample absolute path:
/afs/asu.edu/users/s/a/m/sample1/CSE220/
There are two major relative path operators which are applied whenever we are working with a relative path operation
.
The single dot refers to the current directory you reside in
So “./test.txt” would refer to a file named test.txt within the current directory
/afs/asu.edu/users/s/a/m/sample1/CSE220/test.txt
..
The double dot refers to the parent directory to the current one
One step up the directory tree
So “../test.txt” would refer to a file named test.txt in the parent directory to this one
/afs/asu.edu/users/s/a/m/sample1/test.txt
Navigating directories
The command for navigating directories is “cd”
We can use cd with both absolute and relative paths
cd
changes the path to that specific thing
cd ..
change path the to parent
These can be chained together
cd ../.. goes to the parent of the parent
cd ~
change path to the user’s home directory
All of the above can be combined
cd ../CSE220/Assn1/V1
Navigate to the parent from here
Navigate to CSE220/Assn1/V1
Other Directory Comands
ls
Stands for list
Lists the files and directories within the current active directory
command line arguments:
-a
List ALL things – do not ignore entries that start with a ‘.’
-l
List things in a long format showing properties, timestamps, etc
Combine them ls –al or ls –a –l
There’s other you can get a listing through ls –help
mkdir
Allows you to create a directory
mkdir CSE220
Create a new directory named CSE220 in the current directory
pwd
print the current director (in case you get lost)
–help will generally get you info on any command
ls -l
-rwxr–r– 1 fredffredf20987 Oct 10 10:04 a.out
drwxr-xr-x 1 fredffredf0 Jan 01 2005 src
-rw-r–r–1 fredf fredf 654 Jun 12 18:44 file2
d rwx r-x r-x 1 fredffredf0 Jan 01 2005
Permission for user, group, others
r :– read permitted
w :– write permitted
x :– execution permited
– :- not permitted
Not a directory
Directory
ls –l full details
File Commands
mv
Move/Rename
This command moves a file from one location to another and gives you the opportunity to rename it
mv
mv test.txt ~/CSE220/Assn1/V2/
Move, no rename
mv test.txt test.t
Rename file in same location
mv test.txt ~/CSE220/Assn1/V2/test.t
Move and Rename!
NOTE: You can specify a path for the file as well as the target
mv ~/CSE220/test.txt ./test.txt
File Commands
cp
Copy file
cp gives you the opportunity to provide a path just like mv does allowing you to copy a file to a location
This pretty much works the same way mv does
cp
cp test.txt test.copy
cp ~/CSE220/test.txt ./test.txt
NOTE: you must provide a filename for the copy
File Commands
rm
Remove!!
This is the delete command and like any delete command in a command line environment it can be dangerous!
There is no “recycle bin” – if you delete it – it’s gone!
rm test.txt
You can’t just remove directories, you have to provide a command line argument –r (for recursive)
rm –r V2
NOTE – this will remove the directory and ALL of its contents
Remove
Other handy parameters:
-i
Prompt the user for each deletion, can be safer
-I
A slightly less intrusive version of -i
-v
Delete in verbose mode, see EVERYTHING that happens
often recommended
rm *
REMOVE EVERYTHING THAT ISN’T A DIRECTORY!
rm * -r
REMOVE EVERYTHING!
Changing permissions
Remember back to ls –l?
We can actually change those permissions with the chmod command
chmod ugo=rwx testFile
Give users, groups and other read, write and execute permission
chmod 755 testFile
Use binary patters to set UGO permissions
7 = 111
5 = 101
chmod +x testFile
Give users, groups and others executable permission
chmod go= a.out
remove g and o permissions
File Names and Patterns
With almost all of our commands we can use pattern matching to make them do more powerful things
Some basic pattern matching:
*
Wild card – Any number of any character
rm * – removes all files
rm *.c – removes all files that end in .c
?
Wild card for a single character
rm file?.c
Remove files like: file1.c, file2.c, etc.
Regular Expressions
We can also use Regular Expressions for Advanced pattern matching
This is where things can get really powerful, but also really confusing in a hurry
Basics:
A set of characters to match can be specified with brackets [ ].
A range expression can be used to specify a range of characters, e.g., [a-z].
Multiple range expressions can be given, e.g., [a-zA-Z0-9].
To match a hyphen, make it the first or last character in the set.
If the first character following the opening bracket [ is ! or ^ then any character not in the range is matched
e.g., [^A-Za-z] means match exactly one character that is not a letter
Regex examples
$ rm file0[23].c
Deletes file02.c and file03.c but not file01.c.
$ rm file0[1-2].c
Match file01.c, file02.c, but not a file named file03.c.
$ rm [^f]*
Match any file that does not begin with f.
$ rm [^af-ix-]*
Match any file that does not begin with a, f, g, h, i, x, or hyphen.
$ rm *[0-9]*
Match any file that has at least one digit in file name.
REGEX
Regular Expressions are one of the “hardest” things in Computer Science
I have learned and forgotten them more times than I can count
I have a PPT on them that I will put in the Content
Quickly looking at file contents
We have three commands for looking at file contents
cat
“concatenate”
Concatenates the contents of a file to the Terminal
cat file.t
We can cat multiple files at the same time
cat file1.t file2.t file3.t
There is no separation between the contents
NOTE: cat is just a text dump … if the file is too large for the terminal, only the last parts of the file will be shown
Looking at larger files
more
More is an older command that pages the text dump and waits for the user to continue
The space bar will continue to the next page
more can only scroll forward
To kill it early use CTRL-C
CTRL-C is not copy in this context
less
In this case “less” is more…
less allows you to travel forward and backward
You can literally use the arrow keys to navigate up and down
Q key quits less
Piping hot text!
Let’s take this opportunity to introduce the pipe operator
| – pipe
The pipe operator allows us to take the output of one command and feed it to another
This is INCREDIBLY useful for many activities and we’ll probably have another look at it later for more details
Let’s say you have a lot of stuff in your directory and ls –l is really long … you can pipe it to more or less to control what you see!
ls –l | less
Redirecting I/O
Default Standards:
Input:
stdin – keyboard input
Output:
stdout
stderr
We can actually change the source of Input and Output away from these defaults
Redirecting I/O
> operator
In the context of the command line ‘>’ acts as an output redirection
This allows us to redirect the output from the execution of a command/application/etc. away from stdout and into the location we supply
cat hello.c > helloBak.c
This basically copies the file
if we create an executable with C/C++ we can use the redirect to capture the output
./hello > out.t
Redirecting I/O
< operator
stdin can be redirected through the ‘<‘ operator in the command line
This works for any program that would be looking for input through stdin
Fair warning though … if the input item doesn’t have the right input or enough input it can/will cause errors
Finding Information
grep
No idea what this stands for …
grep searches a file for a pattern match and return the line it exists in
grep
This is an EXTREMELY useful tool at times since you can look for matching information in a file or multiple files
You might use this to sanitize data
If you know what a bad case looks like you can grep your output files for the bad case and deal with it
There are tons of options, so I’m not going to list them here…
But you can use regex, binary, recursion, ignore case, etc.
Controlling your System
Changing things about your environment
Controlling process flow
etc.
Environment Variables
The shell maintains an array of environment variables
environ[]
These variables store the global information used by the shell
For example:
HOME is the path to your home directory
PATH list the paths to all the directories that the shell will search when trying to locate an executable
You can display all of the variables with the ‘set’ command
There are a lot, so let’s pipe it!
set | less
Changing Environment Variables
Generally if you know the variable you can just set them in the command line:
HOME = /afs/asu.edu/users/s/a/m/sample1/CSE220
Changes HOME to that path
You can also use the set command:
set HOME=“/afs/asu.edu/users/s/a/m/sample1/CSE220”
Now … don’t worry overmuch … these changes are all temporary unless you change your profile
If you change the variable in the profile, then it will stay that way
Changing Environment Variables
PATH
Once again this shows what directories are searched when trying to execute something
CHMOD +x
Usually we have to prefix our executables with ./ because the current directory is not searched
We also don’t want to get rid of anything that that already exists … so we kind of need a “+=“
PATH=./:$PATH this accesses the value of PATH
after:
PATH=./:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
Processes
There’s no CTL-SHIFT-ESC or CTL-ALT-Del in a command line environment
Often we need to know what processes are running and even kill them off
ps
This command will list out all active processes with a process ID number that you can work with
$ ps
PID TTY TIME CMD
11838 pts/5 00:00:00 bash
15136 pts/5 00:00:00 ps
This is the short view since it doesn’t show EVERYTHING
-A will show EVERYTHING
-f will give you all the information about it
combining the two will reveal processes that other uses are running!
Processes Processes Jobs Jobs bg < job > Stay Tuned for Part 2 /docProps/thumbnail.jpeg
You can stop a process with the kill command
kill
Signal Kill can’t be caught or ignored and will immediately end the process without any further execution or clean-up
You can send a SIGKILL with a -9
kill -9
kill –s KILL
You can pause a process with a SIGSTOP
kill –s SIGSTOP
kill –s SIGCONT
CTRL-Z will often pause certain processes
A job can contain more than one process
For example processes that are in a pipeline
ps –Af | sort | less
This involves 3 processes
multi-threading is another example as it has multiple threads of execution
fg
forces a job to the foreground
Foregrounding a process will cause it to start back up if it is paused and force it to be the current job
So you can use this instead of kill to restart the paused process
forces a job to the background
you can start any process as a background process by postfixing it with a &
./test &
background processes aren’t necessarily paused, they are just in the background
Part 2 will be shell scripting and more…