Lecture 6
Lecture 6
Displays
system
stats at top
and individual
process stats
at the bottom
Process Status – Linux ps
• Command line instruction to provide a “snapshot” of process
information
– Many different options available
ps vs ps aux
Process Scheduling - Windows
• Windows task
scheduler
– Schedule the task
(action)
• start a program or
script
• send an email
• display a text
message
– The time
• daily
• weekly
• monthly
• one-time occurrence
with starting time
Process Scheduling – Linux at
• at –f filename time [date]
• at –f filename now + value
– if you omit –f filename, you are placed at a prompt to input
one at a time the scheduled task(s)
– Once issued, you can inspect scheduled tasks using atq
– Delete scheduled tasks using atrm
– time specified as HH:MM[am|pm]
• uses military time if am or pm is not supplied
• executes within 24 hours at the next occurrence of that time
• Also available are noon, midnight and teateam (4pm)
– date specified using mmddyy, mm/dd/yy, dd.mm.yy, today
or tomorrow
–
Process Scheduling – Linux cron
• at schedules a 1 time task, crontab schedules recurring tasks
– Create a file that contains the recurrence and task
– Issue the command crontab filename
– Inspect scheduled tasks using crontab –l
– Recurrence is indicated by 5 values: minute, hour (military time),
date, month, day of week (0 to 7, 0 and 7 for Sunday, 1 for
Monday)
• Examples:
– 15 3 1 * * -first day of every month at 3:15 am
– 0 14 * * 0 – every Sunday at 2 pm
– 0 0 12 31 * - every December 31 at midnight
• You can list multiple times using either by separating the
times by commas or using */number where number is degree
of recurrence
– */10 * * * * - every 10 minutes of every hour of every day
Terminating Processes
• Processes usually terminate normally
– User ends the program or the program reaches its ending state
• Some processes will terminate abnormally
– Reach a run-time error such as a memory violation or
arithmetic error
– In Linux, such a process may leave behind a core dump
• the image of the process in memory so that a programmer can debug
it
• Other processes hang requiring that the user terminate
them
– Through Windows task manager’s Processes tab
– In Linux, use the kill command
• kill –s signal pid
• the signal indicates what level to kill the process, with 9 meaning
Services
• A service is a special type of process
– Owned by the OS
– Runs in the background
• this keeps services from negatively impacting processor
performance
– Handles services from various agents (users, software, the
OS, network clients)
– In Linux, services are often called daemons
• A service will read its configuration file to determine
how to act
– We can edit configuration files to alter the service’s
behavior
• In both Windows and Linux we can establish if and
Types of Services
• Logging
– Create log file entries for running software and operating system
operations
– Useful for determining if an event happened as planned or for
troubleshooting
• Scheduling
– Services that determine if a scheduled task should be executed
during this minute or hour
• Network
– Handling communication (incoming, outgoing), dealing with IP
addressing, dealing with specific applications (e.g., ssh, ftp, http,
email), firewall, DNS caching, etc
• File system
– Mounting remote file systems, dealing with RAID storage,
Windows Services GUI
Windows Logging Service
• Windows event viewer displays the results of different
events
– Events are logged at one of the five levels: critical, error,
warning, information, audit success
– Below are examples of warnings and one specific event warning
Automating Services
• In Windows, specify
– when services will run
• at system boot time
• at system boot but delayed until the rest of the system is
running
• disabled (not running)
– what to do when a service stops running (how long to wait
before restarting, how many attempts at restarting)
• In Linux, based on the runlevel, services are either
scheduled to start or stop at initialization time
– Runlevels discussed in the next two slides
• The system administrator can start or stop any service at
any time
Linux Runlevels
• 7 Runlevel as shown below
– Each runlevel starts/stops different services
– The directory /etc/rc.d/rc#.d has symbolic links to
indicate which services start (S) and which stop
(K) (see the next slide)
rc5.d (Runlevel 5) Directory