Friday, February 5, 2010

VxWorks QA

VX WORKS
1. What is the memory layout in Vx Works?
The memory layout in vxworks is known as flat physical address space,
The diagram shows, how the memory is been divided in to different regions on target board RAM
SysPhysMemTop()
SysMemTop()
FREE_RAM_ADDRESS
RAM_LOW_ADDRESS
LOCAL_MEM_LOCAL ADDRESS
2. How Vx Works differ from UNIX.?
VxWorks runs in one mode. No protected vs. user mode switching is done. Running in supervisor
mode on most processors, and not using traps for system calls.
UNIX provides resource reclamation; by default, VxWorks does not.
VxWorks does not have full "process"; it only has tasks, or "threads".
3. Priority inversion & inheritance?
Ref :vxworks manual page 32 chapter :2.4
4. What is IPC (Inter process communication) ?
A technique used to communicate between two process executing on same processor or on
different processor
Any of this ipc can be used for communication
Message queue , Pipes, Shared memory
5. Task in Vx Works?
A task is a smallest unit of execution that can compete on its own for system resources .
It lives in a virtual insulated environment given by the kernel.
6. What are message queues and pipes?
Message queues and pipes are a way of inter task communication used to send and receive message
between two tasks.
Pipes are virtual Io and unidirectional.messages are sent and received in form of bytes
Message queue can be created with variable length messages are sent by passing address of the
buffer which holds the message . message queue created with queue length of one is called as
mailbox , it can be used for synchronization.
User reserved memory
System memory pool
WDB_POOL_SIZE
Vxworks + application
interrupt vector
table,bootline, exception
message
7. Difference b/w Vxworks & Linux OS?
VxWorks runs in one mode. No protected vs. user mode switching is done. Running in supervisor
mode on most processors, and not using traps for system calls. linux provides resource reclamation; by
default, VxWorks does not. VxWorks does not have full "process"; it only has tasks, or "threads".
8. How do you switch between FIFO & Round Robin?
Write bootable application using posix Api Sched_setscheduler
9. Advantages of Vx Works and why?
Vxworks provides characteristics like Deterministic,Multitasking, Fast Context Switching,
Support for Preemptive Based Scheduling Support for Multiple Priority level,Support for Inter
Task Communication, Support for Inter Task Synchronization, Low Interrupt Latency Low
Memory Footprint, Scalable
Which makes intertask communication faster and context switching latency is reduced because,
all tasks resides in common address space,no swaping and paging of memory is used.
Vxworks can be scaled, unnecessary components can be easily excluded.memory usage will be
greatly reduced because of this feature.
Vxworks is extendable, new components can be added like a task.
10. Vx Works memory model?
Flat physical address space refers q1.
11. What are the 2 projects that we can develop on Vx works?
1. Bootable 2. Downloadable
12. How do you compile Vx Works program from command prompt.
On command prompt
To compile the program
>c:\tornado\host\x86-win32\bin
>torVars.bat
>chande the directory to current working directory
>make
13. What is Tornado and its features?
Integrated development environment For vxworks 5.4 , tornado used is 2.0
An integrated source-code editor.
A project management facility.
Integrated C and C++ compilers and make.
The browser, a collection of visualization aids to monitor the target system.
CrossWind, a graphically enhanced source-level debugger.
WindSh, a C-language command shell that controls the target.
An integrated version of the VxWorks target simulator, VxSim.
An integrated version of the WindView software logic analyzer for the target simulator.
14. What does target server do?
Target server provides host-based management of target resources needed by development tools:
Communication with debug agent on target.
Dynamic module loading and unloading.
Host-resident symbol table for target.
Allocation of memory on target for host tools.
All Tornado tools use the Wind River Tool Exchange Protocol (WTX) to communicate with the
target server. The WTX protocol is documented
15. What is the difference b/w downloadable and bootable application?
Bootable Project - A project used to configure and
build VxWorks images for a particular BSP.
Application code may be statically linked to such a
VxWorks image, and the application’s start-up code
may be specified.
Downloadable Project - A project used to manage
and build application modules which can be
downloaded and dynamically linked with a running
VxWorks image. Allows "on the fly" development
16. What is mutex ?
Mutex is mutual exclusion, which provides exclusive hold on resource . In vxworks mutual
exclusion semaphore supports different features
->ownership
->recursion
->Deletion safety
->priority inversion and priority inheritance
17. What is BSP & where is it located?
Board support package which is used to initialize and manage the target board.
C:/Tornado/target/config/bsp
Bsp has a set of files
Config.c
Syslib.c
sysSerial.c
target.nr
18. Difference b/w taskdelay and nanosleep ?
TaskDelay Wind vxworks puts a task in delayed state for specified ticks
Nanosleep posix : puts process in sleep for specified nano seconds
19. How to enable round robin scheduling?
By using API kernelTimeSlice(int ticks)
20. Which is the default scheduling algorithm in Vxworks?
Interrupt driven Priority based pre-emptive scheduling policy
21. Draw the task state diagram.
Ref: vxworks manual chapter 1.3 page 5
22. Diff b/w binary & mutex?
Binary Mutex
Any task or isr can release semaphore the task which owns has to release the semaphore
No recursion and deletion safety yes
sem flush for multiple task synchronization no
can be created with full or empty as initial state by default full
23. Total task priority levels in Vxworks.
Total task priority levels in vxworks 256 . 0 to 256
0=highest 255=lowest
24. Task safe & Task lock?
taskSafe()= safe guard the calling task from deletion
taskLock()=Disable the rescheduling.(avoid preemption from higher priority task)
25. Taskvariables?
To make a shared code as reentrant use taskvariables.
If any global variable used in the code, in order to maintain a private copy of that variable with
respect to a task,use taskvarAdd with that global variable.
The changes made to the global variable in one task will not be reflected in other task
26. Priority levels in POSIX message queues?
32
0= lowest 31=highest
27. How often scheduler comes into picture?
When a new task is created
When ever context switching happens
When one task completes execution
28. Compare VxWorks with other RTOS?
Vxworks Psos Qnx wince
Model Thread/task thread process process
No of priorities 256 256 64 256
Scheduling
policy
Priority,FIFO
or RR
Priority,FIFO
or RR
Priority,FIFO
RR ,adaptive
RR with
adjustable
timeslice
No of states 9 5 14 4
Memory
protection
No No Full Full
Virtual memory No No Yes yes
29. What is default stack size in Vxworks?
Default stack size in vxworks 20000
30. Which flags should be used to achieve priority inheritance and which option should be ored with that
flag
FLAG=SEM_INVERSION_SAFE
OPTION=SEM_Q_PRIORITY
SEM_Q_PRIORITY|SEM_INVERSION_SAFE
semMCreate(SEM_Q_PRIORITY|SEM_INVERSION_SAFE);
31.How to achieve synchronization with out semaphore?
Using message queue with queue length of one,its called as mailbox
32.How to achieve mutual exclusion with out semaphore?
Using taskLock() and taskUnlock() API
33.What is critical/atomic section of the code
The part of the code, if manipulated leads to instability is called as critical or atomic section. The criticak
section of the code can be written between entry(semTake(),taskLock()) and exit (semGive(),taskUnlock).
35.What is interrupt latency
After interrupt is generated to a task, time taken to save the context of the task in to its associated TCB and
to restore the other tasks context to the cpu,and start executing ISR is called as interrupt latency.
36.Which function calls should not to be included in ISR and why
Malloc(),printf()
It takes long amount of execution time.
semTake()
may block the ISR
37.which function call cane be used in ISR
semGive()
msgQSend()
write() to pipe
38.How to achieve multiple synchronization
Using API semFlush()
39.What is diference between monolithic kernel and micro kernel ?
Monolithic kernel: A monolithic kernel has all OS
services (including device drivers, network stacks,
file systems, etc.) running within the privileged
mode of the processor.
A monolithic kernel is easier to make more efficient
(because OS services can run completely without
switches from privileged to non-privileged mode)
UNIX, Linux and Microsoft NT
Micro kernel: A micro-kernel, on the other hand,
uses the privileged mode only for really core
services, and has most of the device drivers and OS
services running as “normal” tasks.
Micro-kernel is more difficult to crash (an error in a
device driver that doesn’t run in privileged mode is
less likely to cause a system halt than an error
occurring in privileged mode).
QNX, FIASCO, VxWorks, and GNU/Hurd
40. What does a task control block (TCB) consists of ?
TCB contains everything the kernel needs to know about the task .
Name and status of the task Priority Task ID Remainder of time slicing
Context switching
information like
Task program counter
,SP, CPU register
I/O assignment, and
delay timer
40.Difference between unitasking and multitasking
Unitasking
A single task controls all components in loop
Example:
Arm()
{
for(;;)
{
if(shoulder needs moving)
moveShoulder();
if(elbow needs moving)
moveElbow();
if(writst needs moving)
moveWrist();
:
:
:
}
}
Disadvantages of unitasking approach:
- Difficult to control the components at different rates.
- Difficult to assign components priorities.
- No preemption capability.
Advantages:
- No context switch overhead.
Multitasking :
each task is simple program operating typically in an infinite loop
the task scheduling is critical issue here
each tasks "thinks" has the processor for itself
each task has its "context" (priority, set of registers, stack area, program counter, timers)
"context switch" is a process of switching the processor between several tasks
each task can be in various states (waiting, ready, running, delayed, interrupted)
Advantages:
- Using different wait commands for each task permits manipulating the components at
different rates.
- Using a priority-base scheduler permits running the most important task in the event that
two tasks enter the “ready” state at the same time.
- Permits easier addition of new components.
41.What makes os an rtos ?
RTOS has to be multitasking and Preemptible
The notion task priority has to exist
Should support priority inheritance
Algorithm and task synchronization
OS behavior should be known
Deterministic OS Behavior
( All Service Calls, Context Switching, Interrupt Latency )
Full support from the vendor.

No comments:

Post a Comment