You are on page 1of 76

Unit- VI

Advance Tools and Technologies(and


problem solving in the OS) :
1
Contents:
• Multiprocessor Scheduling
• Real-Time Scheduling
• Linux Scheduling
• Unix Scheduling
• Windows Scheduling

2
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

4
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

5
Synchronization
Granularity and Processes

6
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

7
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?

8
Static Assignment
• Permanently assign process to a processor
• Dedicate short-term queue for each processor
• Less overhead
• But may leave a processor idle, while others have a backlog
• Solution: use a common queue

9
Dynamic Assignment
• One global queue is maintained.

• Over the life of process, the process may be executed on different


processors at different time.

10
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

11
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

12
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

13
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.
• Dramatic gains in performance are possible in multi-processor
systems.
• Compared to running in uniprocessor systems 14
Approaches to
Thread Scheduling
• Many proposals exist but four general approaches stand out:
• Load Sharing
• Gang Scheduling
• Dedicated processor assignment
• Dynamic scheduling

15
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 16
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.

17
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 where processor utilization is less
important.
• Avoiding process switching speeds up programs

18
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.

19
Real-Time Scheduling
• Correctness of the system depends not only on logical result
of the computation but also 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.

20
Real-Time Systems
• Control of laboratory experiments
• Process control in industrial plants
• Robotics
• Air traffic control
• Telecommunications
• Military command and control systems

21
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
22
Characteristics of
Real Time Systems
• Real time systems have requirements in five general areas:
• Determinism
• Responsiveness
• User control
• Reliability
• Fail-soft operation

23
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

24
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

25
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

26
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.

27
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
28
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.

29
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

30
Two Tasks

31
Periodic Scheduling

32
Execution Profile

33
Aperiodic Scheduling

34
Rate Monotonic Scheduling:
• Assigns priorities to tasks on the basis of their time periods
• Highest-priority task is the one with the shortest period

35
Periodic Task Timing Diagram

36
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

37
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.

38
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

39
Linux Real-Time Scheduling:

40
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

41
Linux Scheduling Data Struct:

42
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
43
SVR Priority Classes

44
SVR Priority Classes
• Real time (159 – 100)
• Guaranteed to be selected to run before any kernel or time-
sharing 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

45
SVR4 Dispatch Queues

46
Windows Scheduling
• Priorities organized into two bands or classes
• Real time
16 Priority levels each
• Variable
• Priority-driven preemptive scheduler

47
Windows Thread
Dispatching Priorities
Fixed Priority
RR

Variable Priority
FIFO

48
Windows Priority
Relationship

49
Handheld OS :
• Handheld System Requirements
• Technology Overview
• Palm OS
• Microsoft Windows CE
• Microsoft Windows Mobile
• Google Android
• Securing Handheld system
• Frame of Reference

50
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

51
Technology Overview :
• TDMA
• Role of SIM
• Global System for mobile communication GSM

52
Introduction to cellular comm tech.

53
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.

54
Dominant cellular technologies
• GSM (Global system for mobile communication)

• CDMA(code division multiple access)

55
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

56
GSM architecture

57
• 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. 58
• 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 59
• 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

60
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

61
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

62
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

63
Data structures :
Heap Organisation RAM Heap Organisation

Heap Header Storage for global variables

Master pointer table


Dynamic Heap

Movable chunks

Storage Heap

Non-movable chunks

Other Heap
End Of Heap 64
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)

65
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

66
Architecture :
Application

.exe .dll interface

Local Process Services


WIN32 API
HEAP

Process Interface

Scheduling, Other Control


Exception Handling, Synch Kernel Lib Interfaces

67

hardware Hardware Interface


Windows CE 5.0 Memory Model:

68
Windows Phone OS 7:

USER MODE

KERNEL SUPPORT

HARDWARE

69
Memory Map for WP OS 7:
FILE SYSTEM DRIVERS GWES
2 GB
Kernel
Space
KERNEL

1 GB for process code


2 GB
Process
Space
70
1 GB for heap, memory mapped files, DLL
Android Architecture:

71
Securing Handheld systems:
• Bio- metric identification
• Finger Print
• Retina scan
• Three Layered Security Model

Intermediate Layer

Kernel

72

Application Layer
Communication between Apps:

App App App


1 2 n

Kernel

Shared Data Area

73
Fig. Communication through own environment
Communication between Apps:

Enterprise
Cloud for
secure storage

App App App


1 2 n

Handheld System / Mobile Phone

74
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

75
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 > Disconnect
> Send > Error 76
> Receive
Frame of reference for handheld systems
1. Functionality: Extent of interoperability ,accuracy in features related to
rendering of media
2. 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
3. Security of services: symbian stand out on public key infrastructure
component based security services are extensible
4. Reliability of operation: recovery & reboots Win-CE has stable & reliable
office suite
5. Extensibility to incorporate newer services: how easy to change or upgrade
services. android & symbian have rich platform than RIM’s Blackberry
6. Maintainability from servicing point of view: diagnostic procedures for
fault detection & location 77
7. Power levels of operation and energy efficiency: energy drain & usage is
regulated by urgency of task.

You might also like