In the robot example, it would be hard real time if the robot arriving
late causes completely incorrect operation. It would be soft real time if
the robot arriving late meant a loss of throughput. Much of what is
done in real time programming is actually soft real time system. Good
system design often implies a level of safe/correct behavior even if the
computer system never completes the computation. So if the computer
is only a little late, the system effects may be somewhat mitigated.
1
What makes an OS a RTOS?
2
Difference Between UNIX and VxWorks
3
tasks will interact. Understanding the interaction between tasks is
important in understanding the behavior of a real-time application.
WindView, which visually displays task interaction while an application
is running, is an invaluable tool in understanding task scheduling.
Because VxWorks uses a single address space model, all tasks access
a common set of global variables. This means that if taskA uses a
global variable named x, that variable is identical to the global variable
x used by taskB. This is in contrast to UNIX, where each process lives
in its own virtual memory space, and does not need to know what
global variables other processes use. There are two primary
consequences of this:
1. All code that declares global variables must ensure that the variable
names do not conflict with those declared by other pieces of
code. It is easy to spot when conflicts occur because the linker will
complain about multiple declarations of the same variable.
2. If a function is to be called by multiple tasks, then it must
be written to be reentrant (i.e., it should not use global variables
to maintain state), or it must be “single threaded” by protecting
it with mutual exclusion semaphores to ensure that only one task
executes it simultaneously.
When porting code from UNIX to VxWorks , the most common way of
complying with both these issues is to gather all the global variables
used by a program into a structure definition, and then to modify the
code to access these variables through a pointer to a structure. Each
time the code is called, this structure can be created as a stack
variable, or “malloc” so that each instance of the code has its own
copy of the variables it uses.
3.Reclaiming resources :
In UNIX, when a process terminates, all the resources that it was using
(e.g., memory that was malloc’d or files that were opened) are
automatically reclaimed by the kernel. This is possible because a
process’s virtual memory space can simply be deleted, freeing up any
memory that it was using, and because the kernel keeps track of which
process is using which resources. If the count of the number of
processes using a particular file reaches 0, the file is automatically
closed.
4
track of users of a resource would result in a performance overhead
that would likely be unacceptable to many users. Because of this, the
responsibility of resource reclamation is given to the application itself.
This means that when a task exits, it is responsible for freeing up any
memory that it allocated, and deleting any other resources that it
created (file descriptors and semaphores, for example). A VxWorks
facility called “task delete hooks” is sometimes useful when
implementing resource reclamation, and is documented in taskHookLib
in the VxWorks Programmers Manual. In practice, this chore is often
not as onerous as might initially appear, because a large number of
real-time applications consist of a number of tasks that are created at
system initialization, and then do not exit until the system is rebooted.
For this type of task, no reclamation is necessary.
4.Implementing a specification :
Many UNIX programmers assume that all processes are complex and
hard to manage. If an application can be implemented within one
thread of execution, then that is how it will be done, regardless of how
well it fits the problem. This may be a valid approach when writing for
UNIX, since processes are indeed complex, hard to manage, hard to
communicate between, and slow to switch execution between.
5
It is important to note, however, that while tasks may incur low
overhead, they are not completely free. Switching between tasks
takes a few microseconds (Wind River publishes benchmark data
sheets for various processor families), and a small amount of memory
is allocated whenever a task is created, so there may still be some
tradeoffs to make when deciding on the number of tasks to use in
implementing your application.
Conclusion :
With the VxWorks tools, you can build applications that satisfy real time requirements.
The VxWorks software consists of development software and run-time software.
• Text editors
• C language compiler
• Assemblers
• Linkers
• Synchronization utilities
• I/O system
• A module loader
7
• VxWorks shell
In Version 5.1:
8
What kind of products have been developed using VxWorks?
- Flight simulators
- Radio and optical telescopes
- Automative ABS & realtime suspension
- Naviation systems
- Deep sea instrumentation
- PBXs
- Traffic control systems
- Modems
- Sonar systems
- Comm/weather satellite test equipment
- X terminals
- PostScript laser printers
- Video Editing, Audio Visual systems
- robotics
- NFS protocol accelerator product
- mass storage tape robot systems
9
Case Studies
10
Case Study 1 : Booting over the network
This Case Study includes two steps one for booting and other for
downloading the vxWorks image.
1.In this first of all make changes in the config.h file of the specific
processor, as in our case study we are using P-III so we have to
make changes in pcPentium’s config file.
• Make changes in the default bootline of Pentium which look like
11
Now to build the Boot Floppy :
Select the corresponding BSP (Board Support Package ) PcPentium in
this case and the type of image as Bootrom_uncmp
Now put the bootrom image in the boot sector of the floppy using
mkboot command which would in our case
mkboot a: bootrom_uncmp
After Booting the target will give a prompt like “[vxWorks Boot]: “
[vxWorks boot]: p
boot device : fei
unit no. :0
processor no: 0
host name : nokia_n7
file name : \vxWorks
inet on ethernet(e) : 157.227.2.101
host inet (h) : 157.227.2.45
user : anonymous
ftp password : anything
12
4. Build the project which will give you custom configured bootable
image.
5. Include this image while booting the target.
-------------------------------------------
1. In this first of all make changes in the config.h file of the specific
processor, as in our case study we are using P-III so we have to
make changes in pcPentium’s config file.
• Make changes in the default bootline of Pentium which look like
The Boot Floppy and the VxWorks image can be made in the similar
manner.
13
Case Study 3 : Including Support for the various
Interfaces
Initial requirement :- You must boot your target with the floppy disc
with the support for your network card included.
After this you have to run the following commands on the target(our
target has ‘fei’ Intel Fast Express network card):
1. ipAttach(0,”fei”) ------ For including the TCP/IP support
1. fdDrv(176 , 6)
Where, second parameter is the Interrupt Level for the Floppy drive
(found from the Resources Tab in Windows NT Diagnostics)
And first parameter is the interrupt Vector, calculated as :- 224-
(8*interrupt level)
2. usrFdConfig(0,0,”/fd0”)
2. usrAtaConfig(0,0,”/devs0”)
14
Case Study 4 to 13 :
15