You are on page 1of 14

REAL TIME OPERATING SYSTEMS

Lesson-8:
I/O Subsystems

2008 Chapter-8 L8: "Embedded Systems - Architecture, Programming 1


and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
1. I/O Subsystem

2008 Chapter-8 L8: "Embedded Systems - Architecture, Programming 2


and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
I/O ports

 Subsystems of OS device management


system─ UART access sub system and the
parallel port access sub system .
 They are used by drivers to communicate
with the many devices that use them
 I/O instructions depend on the hardware
platform.
 I/O systems differ in different OSes.

2008 Chapter-8 L8: "Embedded Systems - Architecture, Programming 3


and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
I/O Subsystem in a Typical I/O System
at in an OS
 Application
 IO Basic functions
 IO device driver functions
 Device Hardware or Port or IO Interface
card

2008 Chapter-8 L8: "Embedded Systems - Architecture, Programming 4


and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
2. I/O Operations

2008 Chapter-8 L8: "Embedded Systems - Architecture, Programming 5


and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
OSes differing IO operations
 Traditional OSes Synchronous IO
operations─ at a certain fixed data transfer
rates.
 RTOSes Asynchronous IO operations ─ at
the variable data transfer rates.

2008 Chapter-8 L8: "Embedded Systems - Architecture, Programming 6


and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
Synchronous IO operations
 Are at a certain fixed data transfer rates.
 Therefore, a task (process) blocks tills till
completion of the IO.
 For example, a write function, write ( ) for 1
kB data transfer to a buffer.

2008 Chapter-8 L8: "Embedded Systems - Architecture, Programming 7


and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
Synchronous IO

 Synchronous IO operation means once


synchronous IO initiates, the data transfer
will block the task till 1 kB data gets
transferred to the buffer.
 Similarly, read ( ) once initiated blocks the
task till 1 kB is read

2008 Chapter-8 L8: "Embedded Systems - Architecture, Programming 8


and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
Asynchronous IO operations
 Variable data transfer rates.
 Permits that a process of high priority to run
and should not block during the IOs.

2008 Chapter-8 L8: "Embedded Systems - Architecture, Programming 9


and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
2. POSIX asynchronous functions for
IOs

2008 Chapter-8 L8: "Embedded Systems - Architecture, Programming 10


and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
POSIX asynchronous functions for
IOs
• aio_read ( )
• aio_write ( )
• aio_list ( )
• aio_error ( )
• aio_cancel,
• aio_suspend ( )─ Suspension is till the next
port-device interruption or till a timed out.
• aio_return ( ) returns the status of completed
operations.
2008 Chapter-8 L8: "Embedded Systems - Architecture, Programming 11
and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
Summary

2008 Chapter-8 L8: "Embedded Systems - Architecture, Programming 12


and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
We learnt
• I/O subsystems are part of OS services.
• Examples are UART access and parallel
port access.
• Synchronous and asynchronous IOs.
• A task gets blocked during the synchronous
IOs, for example, fread ( ) or write ( ).
• RTOSes support asynchronous IOs, for
example, aio_read ( ) and aio_write also in
order to not to block a task during the IOs

2008 Chapter-8 L8: "Embedded Systems - Architecture, Programming 13


and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
End of Lesson 8 of Chapter 8

2008 Chapter-8 L8: "Embedded Systems - Architecture, Programming 14


and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.