Académique Documents
Professionnel Documents
Culture Documents
What is Tornado?
Real-Time, Multitasking OS
Networking
Target
Tool
VxWorks
Tool
Target Server Target Agent
Tool
The tools, registry, and target server can run on different hosts
VxWorks
Target Tool
Server
Target Agent
Tool
VxWorks runs as a process under the host OS The simulator architecture provides no emulation of instruction, native compilers are used
Copyright Wind River Systems, Inc. 5
What is a Task?
A task is a
Kernel object dynamically created at runtime Logical entity consisting of a Task Control Block (TCB) data structure and
foo() {
Functions execute within the context of tasks The VxWorks routine taskSpawn() invokes the entry point function foo
Creating a Task
Multitasking
Task States
10
Multitasking Kernel
The wind kernel is that part of VxWorks which directly manages tasks
It allocates the CPU to tasks according to the VxWorks scheduling algorithm It uses Task Control Blocks (TCBs) to keep track of tasks
One per task Declared as WIND_TCB data structure in taskLib.h O.S. control information state, task priority, delay timer,breakpoint list, error status,I/O
redirections CPU Context Information PC, SP, CPU registers, FPU registers
11
Kernel Operation
Scheduler
12
Multitasking Facilities
13
14
Intertask synchronization
Some intertask synchronization facilities (queues and pipes) also enable data transmission (intertask communication)
Copyright Wind River Systems, Inc. 15
Binary Semaphores
Intertask synchronization is obtained by creating an empty, binary semaphore for the synchronizing event
The task waiting for the event calls semTake( ) and blocks until
the semaphore is given The task or interrupt service routine detecting the event calls semGive( ), which unblocks the waiting task
16
Message Queues
Message queues are kernel objects used for passing information between tasks
The task waiting for the synchronization message calls msgQueueReceive( ) and blocks until a message is on the queue
The task sending the synchronization message calls msgQueueSend( ), which unblocks a pending task
Copyright Wind River Systems, Inc. 17
Pipes
Pipes provide an alternative interface to the message queue facility in the VxWorks I/O system
Tasks block
When they read from an empty pipe, until data is available When they write to a full pipe, until there is space available
Similar to their use of message queues, interrupt service routines can write to a pipe, but cannot read from it
18
Events
tasks
Only tasks can receive events, whereas tasks, interrupt service routines or VxWorks objects can send events Events are synchronous in nature
The receiving task pends while waiting for the events to be sent
19
Mutually exclusive access to shared resources is provided in VxWorks by mutual-exclusion semaphores (mutexes) VxWorks mutexes are designed to address issues inherent to mutual exclusion, like
Priority inversion Deletion safety Recursive access to the shared resource Semaphore ownership
Each critical section of the code has to be protected with mutexes, by having a task
Take the mutex before accessing the code Give the mutex after having accessed it
20
Counting Semaphores
Counting semaphores are similar to binary semaphores, except that they keep track of the number of times the semaphore is given or taken
Every time the semaphore is given, the count is incremented Every time the semaphore is taken, the count is decremented When the count reaches zero, a task that tries to take the
semaphore is blocked
21
Signals
execute a signal handler The signal handler executes in the receiving tasks context and makes use of the tasks stack If no signal handler is installed, the received signal is ignored
Since signals are asynchronous in nature, they are more appropriate for error and exception handling than as a general-purpose intertask communication mechanism
22
23
Projects
Projects can be grouped together in Workspaces For each project more than one build specification can be used
24
Bootable projects
together in a single, non-relocatable object module with no unresolved external references The image can be customized by adding or removing VxWorks components from the Workspace GUI
25
Downloadable Projects
Downloadable projects are used to create relocatable object modules that can be downloaded and dynamically linked to VxWorks
Module downloading and dynamic linking is performed by the
Downloadable projects
Are created by specifying a toolchain GNU or Diab Allow on the fly development
26
27
28
facilities
Browser
System-object viewer, graphical companion to WindShell
CrossWind Debugger
Remote source-level debugger Extended version of the GNU source-level debugger (GDB)
29
WindShell
routines For example, Spawning tasks Creating VxWorks objects like semaphores, message queues, and pipes Download object modules to the target system Perform assembly-level debugging Create and examine variables symbolically Examine and modify memory
30
WindShell
31
Browser
32
Browser
33
CrossWind
CrossWind is a source level, graphical, debugging frontend using an enhanced version of GDB as its debugging engine It allows two debugging strategies
Task mode debugging One task runs under debug control, while other tasks are not
affected CrossWind can either Attach to a running task, or Start a new task under debugger control System mode debugging Whenever a task hits a breakpoint, the whole system stops This is useful to debug tasks, interrupt service routines and prekernel execution
Copyright Wind River Systems, Inc. 34
CrossWind
35
WindView 2.2
WindView allows one to study dynamic interactions of all the elements of complex, real-time systems
36
WindView 2.2
WindView allows
Scrolling the information forward and backward in time Zooming in/out Tailoring the display to only focus on the tasks and events of
interest Setting locks on certain events and searching for their successive occurrences
37
38
WindView allows to
Detect race conditions, deadlocks, CPU starvation and other
problems related to task interaction Determine application responsiveness and performance See cyclic patterns in application behavior Conduct post-mortem analysis of failed systems Detect memory leaks
39
40
zbuf
Sockets
TCP IP
MUX Ethernet PPP
UDP
Transport layer
Network layer
Link layer
41
This allows multiple processors to communicate over their common backplane as if they were communicating over a network by using a standard network driver
host
Ethernet
vx3
vx2
vx1
Shared-Memory Network
This interface decouples the link layer and the network layer
The network protocol does not need to be modified when adding
new network dirvers A new network protocol can be added without modifying the existing MUX-based network driver interfaces
43
Based on the 4.4 BSD TCP/IP release, the TCP/IP protocol suite comprises
UDP User Datagram Protocol Low-overhead delivery mechanism of datagrams, used by
several applications like BOOTP, DHCP, DNS, TFTP, ... TCP Transmission Control Protocol Reliable, end-to-end transmission mechanism, used by Telnet, Rlogin, FTP, ... IP Internet Protocol Hop-by-hop protocol to transmit datagrams ICMP Internet Control Messagge Protocol Reports unexpected events in data transfer, used by ping IGMP Internet Group Management Protocol Used to support multicasting
Copyright Wind River Systems, Inc. 44
Sockets
Sockets allow processes to communicate within a single CPU, across an Ethernet, across a backplane or across any connected combination of networks VxWorks provides
BSD Sockets Datagram Sockets (UDP)
zbuf, zero-copy buffer Applications can read and write BSD sockets without copying data between application buffers and network buffers
Copyright Wind River Systems, Inc. 45
system and receive the command results on standard output and error over socket connection Only the client side implementation is provided A server running on the remote system is assumed
that runs an NFS client Client component A target running VxWorks can mount a remote file system
Copyright Wind River Systems, Inc. 46
remote systems on the network The remote login daemon, rlogind( ), allows remote users to log in to VxWorks
Telnet
The server application only is provided
reply
Copyright Wind River Systems, Inc. 47
accuracy based on time values reported by one or more servers The server provides time information to other systems
48
Both client and server components are provided BOOTP is implemented on top of UDP
49
Like BOOTP, DHCP allows the permanent allocation of configuration parameters to specific clients
However, DHCP also supports the assignment of a network address for a finite lease period VxWorks includes a DHCP client, server, and relay agent The client can retrieve one or more sets of configuration parameters from either a DHCP or BOOTP server The server can process both BOOTP and DHCP messages The DHCP relay agent provides forwarding of DHCP and BOOTP messages across subnet boundaries
50
IP Routing
If the destination is directly connected to the sender (e.g., a point-to-point link) or on a shared network (e.g., Ethernet), then IP datagrams are sent directly to the destination
Otherwise, the sender sends the IP datagrams to a default router,
Each router maintains a routing table, which is used to deliver the IP datagrams to either
A local IP address, for a direct route, or The next-hop router IP address, for an indirect route
51
Dynamic routing occurs when routers talk to adjacent routers, informing each other of what network each router is connected to Entries in the routing tables change dynamically as routes change over time The Routing Information Protocol (RIP) is provided with VxWorks
This is intended for small to medium-sized networks The longest path must be less than 16 hops It uses a distance-vector protocol It contains a vector of distances as the hop count RIP version 1 and 2 are supported
52
Summary
Networking
Connects hosts and targets during development and
53
References
Manuals available either in the Tornado on-line help, or via the Wind River Bookstore at: www.windriver.com/windsurf/bookstore
Tornado Users Guide WindView Users Guide and Users Reference VxWorks Programmers Guide
VxWorks OS Libraries
VxWorks Network Programmers Guide
54