Operating Systems CIS 250

Download Report

Transcript Operating Systems CIS 250

CIS250
OPERATING SYSTEMS
WIN2k Lab # 3
•
•
•
•
Creating User Accounts
Defining User Profiles
Creating Groups
Setting System Policies
Creating User Accounts
• Every WIN2K user must have a user
account
– networked computers may have a domain or a
local account
– non-networked computers always have a local
account
• Use the USERS AND PASSWORDS tool in
control panel
User Accounts (contd.)
• Set up a naming convention - one that is
easy to use/remember
– first initial, last name
• Two User Accounts are setup automatically
when WIN2K is installed
– administrator - has privileges to do anything
– guest - not assigned password (but you can
assign one); is disabled by default; has limited
access
User Accounts - contd.
• After an account is setup, you can manage
Certificates via the Advanced tab
– new to WIN2K: allows absolute identification
of users, companies and systems
• secure boot settings - CTRL-ALT-DEL
– prevents other programs from running during log on
• You can also change to which group a
member belongs, but cannot edit a group
• To change a password, click the Set
Password button
User Profiles
• Each user has a profile
• Administrator enters info on the user’s
home directory, logon script, where the
profile is stored
• When a user picks a new wallpaper,
changes system sounds or makes other
config changes - the profile changes
User Profiles (contd.)
• Check boxes
– User Must Change password at next login
– User Cannot change password (if shared by
multiple people)
– Password never expires (used for Admin
account, but not recommended for others)
– Account Disabled - employee on leave
– Account Locked - too many bad logon attempts
Groups
• Assign access to a group of users
– saves on typing, errors
• Default: all users are Power Users
• Can assign users to another type of group
– done though Local Users and Group console
Built-in Local Groups
• Administrators - all power
• Power Users - share dir and printers;
add/change, del printers, users, groups (del
and change only the ones they created);
change system clock
• Users - run applications, manage files,
manage own profile, use printers
Groups
• Guests - limited access to files and
programs
• Backup Operators - backup/restore files
• Replicator - Windows can copy files from
one workstation to another
System Policies
• Can set in MMC or Local Security Policy
console in Admin Tools in Control Panel
• Set a policy to determine:
– how users logon
– how passwords are treated
– user rights of files, device drivers (system
default usually Admin only)
Chapter Four
Processes
• A system is a collection of processes
• A process is defined as a program in
execution; it is active, not passive.
Concepts
• In the early days, one program was run at a
time; now there is multi-programming.
Many programs are loaded into memory
and are executed concurrently.
– CPU multiplexes - processes are switched by
the CPU
Process
• A unit of work in a time-sharing system
• Even if only one program is executing, the
O/S has internal processes executing
• Process execution is sequential: one
instruction at a time
• Made up of program code, program counter
value (indicates current activity), registers,
stack (temp. info: variables, data,
parameters)
Process State
• When a process executes, there are changes
in its state
–
–
–
–
–
NEW (create)
RUNNING (executing)
WAITING (I/O)
READY (awaiting CPU)
TERMINATED
Process Scheduler States
•
•
•
•
•
•
•
•
RUN pat.c
Read fieldA.dat
c=a+b
d=(a*b)-c
e=a-b
write a,b,c,d,e
stop
end
read
I/O cycle (wait)
CPU cycles
I/O cycle (wait)
Terminate
CPU Cycle Duration
• The distribution of CPU cycle times
– Most jobs are I/O bound: printing
– Few jobs are CPU bound (computation)
Process Control Block
• PCB is a repository of info for a process
• Contains information about a process: state,
program counter (address of next
instruction), registers, CPU scheduling
information, memory management
(base/limit registers, page tables),
accounting, CPU time, actual time, I/O info:
list of devices, open files
PCB
• Physically, it is a data structure containing
information about the state of a process
– a data structure is a method of representing an
abstract data type
• dynamically allocated memory linked together with
pointers
PCB
Pointer
process state
process number
program counter
registers
memory limits
open files
•
•
•
•
ready, wait
PID
next instruction addr
stack ptrs, condition
code, prty sched.alg.
• Base, limit
• reading, copying
Process Scheduling
• In multiprogramming, maximize CPU
utilization by having a process run at all
times
• In time-sharing, process switching is done
frequently so that users can interact with the
program while it is running
– Queues
– Schedulers
– Context Switch
Linked Lists
• Linked list allocates memory for new items
when necessary and destroys memory when
it is no longer needed; memory is combined
into a single entity: set of nodes
– each node has a pointer which points to the next
node in the list
– not necessarily stored contiguously
– to find a node, must start at the beginning and
“walk” through the list using the pointers
Queues
• Stored as a linked list
• PCBs are linked to form queues
• When a process enters the system, it is put
into a job q
• For example, all ready jobs are linked lists
on the readyq (in memory, waiting to exec)
– device queue - processes waiting for I/O
• Waiting jobs are linked by “reason for wait”
– printer -> printer list
– diskdrive -> disk list
Schedulers
• Manage queues
• Types
– Short term - CPU scheduler selects the job from
memory and allocates CPU time
– Long-term - job scheduler determines which
jobs are put into memory
– Medium term - intermediate scheduler; for
time-sharing, swap jobs
• Frequency of execution: short term is often.
Long term controls the number of jobs in
memory (degree of multi-programming)
• Otherwise, I/O bound jobs will cause CPU
(short term scheduler) to be idle or devices
could be idle
Process Scheduling Algorithms
• First come, first served - turnaround time is
unpredictable
– job A - 10 minutes
– job B - 1 minute
– job C - 20 minutes
• Shortest Job Next/First - good for batch;
know CPU time in advance
• Priority Scheduling - gives preference to
certain jobs
• Shortest remaining time - batch jobs have
less time (lower priority)
• Round robin - CPU is shared equally among
all processes
– time slice/quantum - each job is allowed a time
slice
Context Switch
• When switching the CPU to another
process:
– saving old process info
– load state for new process
• Overhead
• speed of a context switch dependent on
memory speed, number of registers to be
copied
• speed also affected by hardware:
Processes Operations
• Want processes to execute concurrently and
create and delete processes dynamically
– Process Creation
– Process Termination
Process Creation
• “create process” system call
– parent process, children
• Requires CPU, memory, devices, files
• 1) Parent creates child
– parent continues to execute concurrently
– parent waits until some children terminate
• 2) address space of child
– duplicate of parent
– load program into it
• UNIX PID - fork creates a process; copies
address space of parent; parent can talk to
child
• DEC VMS - creates new process, loads a
pgm (parent specifies name of pgm for OS
to load into the address space of new
process)
• NT does both
Process Termination
• EXIT - resources are deallocated
• ABORT - system call by parent: kill child need to know PID of child
– exceeded resources
– child task no longer required
– parent is exiting
• In VMS, child can’t exist without parent cascading termination by the OS
• UNIX too (not always)
Cooperating Processes
• Processes share data; changes in data can
affect programs
• Reasons for sharing
– file sharing
– computational speedup - subtasks
– modular - divide functions into separate
processes
– convenient - work on many tasks at a time
• Concurrent execution - need mechanisms
for processes to communicate and
synchronize
• Producer/Consumer - produces creates info,
consumer consumes it
– example: print program produces characters,
printer consumes it
– need a buffer - producer loads it, consumer
empties it
– need to synchronize so they don’t use at same
time
Buffer
• Unbounded - no limit to buffer size
• Bounded - fixed size; consumer must wait
until it is empty, producer waits until it is
full
Threads
• In order to share resources concurrently
• A task, a unit of CPU utilization
– has a program counter, register set, stack space
• With peer threads shares: code, data and OS
resources
• No memory management work - thread
switch doesn’t have to call the OS and cause
an interrupt to kernel
• quick, efficient
Processes
• Interprocess Communication
–
–
–
–
–
–
Basic Structure
Naming
Direct Communication
Indirect Communication
Buffering
Exception Conditions
Threads
• States: ready, blocked, running, terminated
• Thread shares CPU, one at a time
– child threads are not independent
– can access every address within the task and
can write over another threads stack
– one user per task - each task can have multiple
threads; if one thread is waiting, another can
run;
– can make producer/consumer threads in a task little overhead for switching
• WIN3.1 - cooperative, multi-tasking
– share data,resources; multiple processes
execute concurrently; several processes appear
to run at the same time
• UNIX - preemptive, multi-tasking allocates CPU to processes based on preset
time slices; a deadlock of one won’t affect
others
• NT/WIN2K - preemptive, multi-tasking,
multi-threaded: a process can break up into
several threads of execution
– default: process contains one thread: unique id,
registers contain state
• WIN95/98 - preemptive, multi-tasking uses
predetermined time slices (default 20ms)
– each button on task bar is a process
– each is divided into threads, share CPU - take
turns
Interprocess Communication
•
•
•
•
•
•
Basic Structure
Naming
Direct Communication
Indirect Communication
Buffering
Exception Conditions