File - e-study

advertisement
Unit- VI
Advance Tools and Technologies(and
problem solving in the OS) :
Contents:
•
•
•
•
•
•
Uniprocessor Scheduling
Multiprocessor Scheduling
Real-Time Scheduling
Linux Scheduling
Unix Scheduling
Windows Scheduling
Uniprocessor Scheduling :
•
•
•
•
•
FCFS
RR
SJF/SPN
SRT
Priority Scheduling
• Preemptive Scheduling
• Non preemptive Scheduling
Classifications of
Multiprocessor Systems
• Loosely coupled processors,
• Each has their memory & I/O channels
• Functionally specialized processors
• Controlled by a master processor
• Such as I/O processor
• Tightly coupled multiprocessing
• Processors share main memory
• Controlled by operating system
Granularity
• Or frequency of synchronization, between processes in a
system.
• Five categories, differing in granularity:
•
•
•
•
•
Independent Parallelism
Coarse Parallelism
Very Coarse-Grained Parallelism
Medium-Grained Parallelism
Fine-Grained Parallelism
Synchronization
Granularity and Processes
Scheduling Design Issues
• Scheduling on a multiprocessor involves three interrelated
issues:
• Assignment of processes to processors
• Use of multiprogramming on individual processors
• Actual dispatching of a process
• The approach taken will depend on the degree of granularity
of applications and the number of processors available
Assignment of
Processes to Processors
• Assuming all processors are equal, it is simplest to treat
processors as a pooled resource and assign process to
processors on demand.
• Should the assignment be static or dynamic?
• Dynamic Assignment
• threads are moved from a queue for one processor to a queue for
another processor.
Static Assignment
• Permanently assign process to a processor
• Dedicate short-term queue for each processor
• Less overhead
• Allows the use of ‘group’ or ‘gang’ scheduling
• But may leave a processor idle, while others have a backlog
• Solution: use a common queue
Assignment of
Processes to Processors
• Both dynamic and static methods require some way of
assigning a process to a processor
• Two methods:
• Master/Slave
• Peer
Master - Slave Architecture:
•
•
•
•
Key kernel functions always run on a particular processor
Master is responsible for scheduling
Slave sends service request to the master
Disadvantages
• Failure of master brings down whole system
• Master can become a performance bottleneck
Peer architecture
• Kernel can execute on any processor
• Each processor does self-scheduling
• Complicates the operating system
• Make sure two processors do not choose the same process
Scheduling :
• Process Scheduling :
• Usually processes are not dedicated to processors
• A single queue is used for all processes
• Or multiple queues are used for priorities
• All queues feed to the common pool of processors
• Thread Scheduling
• An application can be a set of threads that cooperate and execute
concurrently in the same address space
• Dramatic gains in performance are possible in multi-processor
systems
• Compared to running in uniprocessor systems
Approaches to
Thread Scheduling
• Many proposals exist but four general approaches stand out:
•
•
•
•
Load Sharing
Gang Scheduling
Dedicated processor assignment
Dynamic scheduling
Load Sharing
• Processes are not assigned to a particular processor
• Load is distributed evenly across the processors
• No centralized scheduler required
• FCFS
• Smallest no of Threads First
• Pre-emptive Smallest no of Threads First
• Disadvantages :
• Central queue needs mutual exclusion
• Can lead to bottlenecks
• Preemptive threads are unlikely resume execution on the
same processor
Gang Scheduling
• A set of related processes are scheduled to run on a set of
processors at the same time
• Parallel execution of closely related processes may reduce
overhead such as process switching and synchronization
blocking.
• Single decision affects a number of processors and processes
at one time, so less scheduling overhead.
Dedicated Processor
Assignment
• When application is scheduled, its threads are assigned to a
processor
• Some processors may be idle
• No multiprogramming of processors
• Useful in:
• Highly parallel systems, processor utilization is less important
than effectiveness
• Avoiding process switching speeds up programs
Dynamic Scheduling
• Number of threads in a process are altered dynamically by the
application
• This allows the OS to adjust the load to improve utilization
• If idle processor, allocate it.
• If new job, allocate processor from the job having more than
one.
• If a job needs more processors, wait until available or request
cancels.
• If processor becomes free, allocate it to waiting jobs.
Real-Time Scheduling
• Correctness of the system depends on logical result of the
computation as well as on the time at which the results are
produced.
• Tasks or processes attempt to control or react to events that
take place in the outside world.
• These events occur in “real time” and tasks must be able to
keep up with them.
Real-Time Systems
•
•
•
•
•
•
Control of laboratory experiments
Process control in industrial plants
Robotics
Air traffic control
Telecommunications
Military command and control systems
Terms:
• Periodic vs Aperiodic
• Periodic tasks
• Are completed regularly, once per period T or T units apart
• Aperiodic tasks
• have time constraints either for deadlines or start
• Hard vs Soft
• “Hard “ real time task:
• One that must meet a deadline
• “Soft” real time task
• Has a deadline which is desirable but not mandatory
Characteristics of
Real Time Systems
• Real time systems have requirements in five general areas:
•
•
•
•
•
Determinism
Responsiveness
User control
Reliability
Fail-soft operation
Determinism
• Operations are performed at fixed, predetermined times or
within predetermined time intervals
• Concerned with how long the operating system delays before
acknowledging an interrupt and there is sufficient capacity to
handle all the requests within the required time
Responsiveness
• How long, after acknowledgment, it takes the operating
system to service the interrupt
• Responsiveness includes:
• Amount of time to begin execution of the interrupt
• Amount of time to perform the interrupt
• Effect of interrupt nesting
User control
• It is essential to allow the user fine-grained control over task
priority.
• May allow user to specify things such as paging or process
swapping
• Disks transfer algorithms to use
• Rights of processes
Characteristics
• Reliability
• Degradation of performance may have catastrophic
consequences
• Fail-soft operation
• Ability of a system to fail in such a way as to preserve as much
capability and data as possible
• Stability is important – if all deadlines are impossible, critical
deadlines still meet.
Features of Real-Time OS:
•
•
•
•
•
•
•
•
Fast process or thread switch
Small size
Ability to respond to external interrupts quickly
Multitasking with inter-process communication tools such as
semaphores, signals, and events
Use of special sequential files that can accumulate data at a
fast rate
Preemptive scheduling base on priority
Minimization of intervals during which interrupts are disabled
Delay tasks for fixed amount of time
Classes of Real-Time
Scheduling Algorithms
• Static table-driven
• Task execution determined by a feasibility schedule
• Static priority-driven preemptive
• Traditional priority-driven scheduler is used
• Dynamic planning-based
• Feasibility determined at run time
• Dynamic best effort
• No feasibility analysis is performed
• Aborts any started process whose deadline is missed.
Deadline Scheduling
• Real-time applications are concerned with completion of task
strictly on the basis of time
• Information used
•
•
•
•
•
•
•
Ready time
Starting deadline
Completion deadline
Processing time
Resource requirements
Priority
Subtask scheduler
Two Tasks
Periodic Scheduling
Execution Profile
Aperiodic Scheduling
Rate Monotonic Scheduling:
• Assigns priorities to tasks on the basis of their time periods
• Highest-priority task is the one with the shortest period
Periodic Task Timing Diagram
Priority Inversion
• Can occur in any priority-based preemptive scheduling
scheme
• Occurs when circumstances within the system force a higher
priority task to wait for a lower priority task
• Unbounded Priority Inversion :
• Duration of a priority inversion depends on time related with
handling shared resource as well as unpredictable actions of
other unrelated tasks
Unbounded Priority Inversion:
• Avoiding Unbounded Priority Inversion:
• Priority Inheritance
• Lower-priority task inherits the priority of any higher priority task
pending on a resource they share
• Priority Ceiling
• Priority assigned to resources.
• Priority of resource is one level higher than highest priority user.
Linux Scheduling
• Scheduling classes
• SCHED_FIFO: First-in-first-out real-time threads
• SCHED_RR: Round-robin real-time threads
• SCHED_OTHER: Other, non-real-time threads
• Within each class multiple priorities may be used
• Total 140 priority levels
• Real time priorities:- 0-99
• Non-real time priorities:- 100-139
Linux Real-Time Scheduling:
Non-Real-Time Scheduling:
• Linux 2.6 uses a new scheduler the O(1) scheduler
• Time to select the appropriate process and assign it to a
processor is constant
• Regardless of the load on the system or number of processors
Linux Scheduling Data Struct:
UNIX SVR4 Scheduling
• The new algorithm is designed over previous UNIX algorithms
to give:
• highest preference to real-time processes,
• next-highest preference to kernel-mode processes,
• and lowest preference to other user-mode processes, referred to
as time-shared processes.
• New features include:
• Pre-emptable static priority scheduler
• Introduction of a set of 160 priority levels divided into three
priority classes
• Insertion of preemption points
SVR Priority Classes
SVR Priority Classes
• Real time (159 – 100)
• Guaranteed to be selected to run before any kernel or timesharing process
• Can preempt kernel and user processes
• Kernel (99 – 60)
• Guaranteed to be selected to run before any time-sharing process
• Time-shared (59-0)
• Lowest-priority
SVR4 Dispatch Queues
Windows Scheduling
• Priorities organized into two bands or classes
• Real time
• Variable
16 Priority levels each
• Priority-driven preemptive scheduler
Windows Thread
Dispatching Priorities
Fixed Priority
RR
Variable Priority
FIFO
Windows Priority
Relationship
Handheld OS :
•
•
•
•
•
•
•
•
Handheld System Requirements
Technology Overview
Palm OS
Microsoft Windows CE
Microsoft Windows Mobile
Google Android
Securing Handheld system
Frame of Reference
Handheld System Requirements:
•
•
•
•
•
•
•
•
Small physical size
Powered by battery
Small display area
Few ports for attachments
Capable of configuring browser and email
Drivers for microphones, speakers etc.
Security
Application support
Technology Overview :
• TDMA
• Role of SIM
• Global System for mobile communication GSM
Introduction to cellular comm tech.
Fig. Cellular grid with base station
Cellular Grid :
• A single BST provide wireless service in small geo. region called cell.
• Region divided into cells .
• If density of subscribers grows beyond a threshold then cell spilt
into microcell.
• Mobile users move from one cell into other & because of handover
protocol get seamless service.
• Adjacent cells must use different frequencies.
• Non adjacent may use same frequencies.
Dominant cellular technologies
• GSM (Global system for mobile communication)
• CDMA(code division multiple access)
GSM
• Mobile terminal in cell “i” wish to connect with another
mobile terminal in cell “k”
• MT-i sender--->senders base station R---->MSC-u…….MSC-v------>receivers base station S--------------->MT-k receiver
• MT: Mobile Terminal (Mobile Station)
• MSC: Message Switching Center
GSM architecture
• Public land mobile n/w(PLMN):
- Mobile operators n/w coverage is considered to be PLMN
• New subscription initiation:
-equipment carries unique international mobile station
identity(IMSI) number.
- 3 parts of IMSI
country(3 digit)
mobile n/w code(2 digit)
subscriber code(10 digit)
-equipment carries subscriber identity module(SIM)
- Equipment reached by dialing MS-ISDN number
-registration recorded in HLR of MSC.
• Home location register(HLR):
-stores semi-permanent information about subscribers as IMSI no,activity
status,,current location,profile of subscribed services.
- roaming subsc. Is visitor in other MSC area.
-helps in authenticating visitor
• Visitor location register(VLR):
-service profile obtained from HLR & stored temporary in VLR
- maintain database of all registered visitors
• Authentication center(AUC):
-auth parameters are generated from initial local info
• Equipment identity register:
-to check genuineness of eqipment
-used to trap misuse.
-maintain white ,gray,black list
• Gateway mobile switching centre(GMSC):
- to connect to other network
• GSM interworking unit(GIWU):
• Message center(MXE):
-provide messaging service in store & forward mode
• Message service node(MSN):
-handles intelligent network services
• Operations & maintenance service center(OMSC):
-continuous monitoring for quality & maintaining records of
services provided to the subscribers
Specification & features used in
GSM
• Frequency band for mobile users 1850-1990MHZ
• Band divided into channel & channel separation 200 kHz
• Adjacent cells use different channels & nonadjacent may use
same channel.
• For modulation of carrier use GMSK.
• Uplink & downlink freq are 80 MHZ apart.
• Uses linear predictive coding for speech encoding
• Transmission rate over air is 270 kbps
• BST uses slotted time frames
GSM services
• Tele –services
- voice & short messaging services & tele fax
-non voice can be pt to pt or pt to multipoint
• Bearer services
-data services
-data transfer rate from 300 to 9600bps
• Supplementary services
-operator specified as well user specified
-e.g call forwarding, call barring,ring tone download
Palm OS :
• Launched by Palm Inc. in 1996
• Implemented on smart phones, wristwatches. Handheld
gaming console, barcode reader etc.
• Memory Management in Palm OS:
• RAM: third party apps, user data, run time storage
• ROM: OS kernel, frequently used databases, some built in apps
• A chunk - contiguous memory between 1byte ~ 64 KB that has
been allocated by the Palm OS memory manager
• Each chunk resides in a heap
Data structures :
Heap Organisation
Heap Header
RAM Heap Organisation
Storage for global variables
Master pointer table
Dynamic Heap
Movable chunks
Storage Heap
Non-movable chunks
Other Heap
End Of Heap
Memory Manager :
• List of free chunks is maintained
• Frequent allocation and release leads to fragmentation
• Compaction is used to over come fragmentation
• Power Management:
• Battery Operated
• Battery change without suspension of system operation
• Large capacitor is provided for that purpose (super capacitor)
Microsoft Windows CE :
•
•
•
•
•
For smart handheld devices
Support for real time operations.
Security with device locks, authentication using passwords
Support for Wi-Fi , Bluetooth
Support for multitasking for more than 32 processes
Architecture :
Application
.exe .dll interface
Local Process Services
HEAP
WIN32 API
Process Interface
Scheduling,
Exception Handling, Synch
hardware
Kernel Lib
Other Control
Interfaces
Hardware Interface
Windows CE 5.0 Memory Model:
Windows Phone OS 7:
USER MODE
KERNEL SUPPORT
HARDWARE
Memory Map for WP OS 7:
FILE SYSTEM
DRIVERS
GWES
2 GB
Kernel
Space
KERNEL
2 GB
Process
Space
1 GB for process code
1 GB for heap, memory mapped files, DLL
Android Architecture:
Securing Handheld systems:
• Bio- metric identification
• Finger Print
• Retina scan
• Three Layered Security Model
Intermediate Layer
Kernel
Application Layer
Communication between Apps:
App
1
App
2
App
n
Kernel
Shared Data Area
Fig. Communication through own environment
Communication between Apps:
Enterprise
Cloud for
secure storage
App
1
App
2
App
n
Handheld System / Mobile Phone
Fig. Communication through own environment
Built In Security Mechanism :
•
•
•
•
•
•
Personal information Manager (PIM)
GPS tracker
Feature to erase data on sending predefined message
Pair wise authentication in Bluetooth
Firewall policy
Lock Mechanism
• Use of IMEI number
Security with external device:
• Memory Stick
• Saving personal information
• Password protection
• Encryption
• SD card
•
•
•
•
•
SDIO:- SD card and Host IO operations
Idle state
Ready State
Inactive State
Executing State:
> Stand By
> Send
> Receive
> Disconnect
> Error
Frame of reference for handheld systems
1.
2.
3.
4.
5.
6.
7.
Functionality: Extent of interoperability ,accuracy in features related to
rendering of media
Usability of device: choice based on usage patterns.
Blackberry – heavy duty e-mail usage
i-phone- media rich for music & videos
palm os –personal information mngt
ease with which one can learn & discover features
Security of services: symbian stand out on public key infrastructure
component based security services are extensible
Reliability of operation: recovery & reboots Win-CE has stable & reliable
office suite
Extensibility to incorporate newer services: how easy to change or upgrade
services. android & symbian have rich platform than RIM’s Blackberry
Maintainability from servicing point of view: diagnostic procedures for
fault detection & location
Power levels of operation and energy efficiency: energy drain & usage is
regulated by urgency of task.
Download