Real Time Programming

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/72

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

73 Terms

1
New cards

pthread_join() function is a non-blocking function.

False

2
New cards

Using QNX Message Passing, what will a server receive messages on?

Channels

3
New cards

Consider this scenario. A thread of priority 10 is running, and now it becomes blocked. Will this thread lose its priority?

The thread will not lose its priority; when it unblocks, the thread will be placed at the end of the ready queue of all threads with priority of 10.

4
New cards

Which form of IPC provided by the QNX Neutrino kernel usually results in the termination of a process?

Signals

5
New cards

Identify the two types of semaphores that are supported in QNX's Neutrino.

Named and unnamed

6
New cards

Consider the following scenario regarding threads. Thread X unblocks and then Y unblocks. When will X run?
Priority: Ready: Blocked:
50 Y(r)
49 A(f) X(r)
48 Z(r), B(r) C(f)

When both A and Y complete or block.

7
New cards

QNX's Neutrino provides a scheduling algorithm named 'other'. Which scheduling algorithm listed below is the same as 'other'?

Round Robin

8
New cards

What is the default password for qnxuser?

qnxuser

9
New cards

Suppose your "Hello World" program from Lab 2 is running as a process, and its PID is 1234. Sending a SIGUSR2 signal to 1234 will terminate the process.

True

10
New cards

What is the name given to the microkernel and process manager in QNX?

procnto

11
New cards

What is the correct order of pseudo-code (or PDL) for this server?

ChannelCreate(); do { MsgReceive(); perform processing; MsgReply(); } while(true);

12
New cards

Which function do you call to decrement a semaphore?

sem_wait()

13
New cards

QNX Message Passing is ____________ based and has ____________ communication.

Client-server, bidirectional

14
New cards

Suppose you write a program that calls the fork() function. At which point in the code does the newly created process start executing?

The forked process starts executing from the point where fork() is called.

15
New cards

Which properties best describe signals in QNX Neutrino?

Asynchronous, non-blocking

16
New cards

The ConnectAttach() function requires three identifiers as function parameters. What are those three (3) identifiers?

The node descriptor, the server's process ID, and the server's channel ID.

17
New cards

In QNX message passing, as soon as the client call its MsgSend(), it blocks and remains blocked until the server calls which function?

MsgReply()

18
New cards

In QNX message passing, if the server calls MsgReceive() before the client calls its MsgSend(), then in what state will the server process be in?

receive blocked

19
New cards

In Phase II of QNX message passing, how does the server know that the client sent a pulse?

The MsgReceive() function returns 0 (zero).

20
New cards

Recall Lab 3 - Process and Signals. In Part A of the lab, you registered a user-defined function, named handler(), to be the signal handler when the process receives a SIGUSR1 signal. The handler() function is defined as:
void handler() { usr1Happened = 1; }
What is the correct declaration of the usr1Happened variable in the 'C' programming language?

volatile sig_atomic_t usr1Happened;

21
New cards

Recall in "Lab 2 - Hello World" you created your first QNX Neutrino program. Assuming you uploaded the Hello World binary executable file to Neutrino, the call to getppid() will return the process ID of which process?

ksh

22
New cards

Which of these IPC methods blocks?

Message Passing

23
New cards

How are messages passed between processes on the same node passed?

The message is copied.

24
New cards

Which of the following terms below best describes the procedure of saving all registers of one process and then reloading all registers with the values for another process?

Context switch

25
New cards

Suppose you open a named semaphore:
sem_open( "/my_sem", O_CREAT, S_IWOTH, 0 );
What is the absolute path to the named semaphore on the QNX filesystem?

/dev/sem/my_sem

26
New cards

Which command lists the running processes on Neutrino?

pidin

27
New cards

Consider QNX message passing. Suppose you want the client to establish a connection to the server. Which function should you call?

ConnectAttach()

28
New cards

What is the default scheduling algorithm for newly created threads?

Round Robin

29
New cards

Recall in Lab4 - Thread Synchronization, the program thread-factory prompted the user for the number of threads to create. According to POSIX, which function should you immediately call after calling the pthread_create() function, and before creating the next thread?

pthread_attr_destroy()

30
New cards

In the context of scheduling algorithms for threads, the term resumption is best defined as?

When all threads of higher priority are finished with the CPU, the thread that was preempted is then given CPU time again.

31
New cards

Which of these are properties of QNX message passing (MsgSend(), MsgReceive() and MsgReply()?

Synchronous, blocking

32
New cards

Suppose one thread owns a mutex associated with a particular resource and two other threads are waiting for the same resource. Next, the thread which owns the mutex gives it up when finished with the resource. Which thread should get the mutex? Neutrino uses two criteria to decide. What are the two criteria, in-order of precedence?

priority level and length of wait

33
New cards

What is the normal scenario for process creation and termination?

The parent process waits until all the children terminate.

34
New cards

Which of the following is not a valid scheduling algorithm in QNX?

LIFO

35
New cards

Which of the following scheduling algorithms can cause a thread's priority to lower?

Sporadic

36
New cards

What is meant by pre-emption?

The CPU can be taken away from a thread with the intention of returning the thread back to the CPU at a later time.

37
New cards

Which of the following is not a form of IPC that is found on QNX?

Semaphores

38
New cards

Which scheduling algorithm allows a thread to run on the CPU for as long as it needs it?

FIFO

39
New cards

In Neutrino, there is a special thread called the "idle thread". What is the priority of the "idle thread"?

0

40
New cards

What is returned by the int ChannelCreate(...) function?

channel ID

41
New cards

Which type of diagram shows the set of states and transitions between states?

State transition diagram

42
New cards

In QNX message passing, if the client process calls MsgSend() before the server calls its MsgReceive(), then in what state will the client process be in?

send blocked

43
New cards

On QNX Neutrino, which command will run the program "myprog" in the background?

./myprog &

44
New cards

The QNX Neutrino RTOS supports many POSIX signals, including traditional UNIX signals. Of these signals, there are at least two signals that cannot be blocked nor be caught. For example, one of these signals is SIGKILL. Of the following signals, which signal cannot be blocked nor caught?

SIGSTOP

45
New cards

The QNX Neutrino RTOS is based on which type of architecture?

microkernel

46
New cards

In Phase II of QNX message passing the client calls which function to receive the reply message from the server?

MsgSend()

47
New cards

Which software application do you use to download and install the QNX Software Development (SDP) version 7.1 and other compatible products, add-ons, and BSPs?

QNX Software Center for your BYOD

48
New cards

Under which conditions would a counting semaphore block?

The semaphore value is zero

49
New cards

Context switching is fastest between?

a) threads are in the same process and threads are in the ready (to run) queue

50
New cards

Consider the Thread Scheduling Table below when answering the next five (5) questions. Each question is sequential. Meaning, the Thread Scheduling Table will change as operations complete from previous questions.

Which thread in the above table should be running (R)?
Priority: Ready: Blocked:
44 A(r), B(r)
43 C(r) D(f)
42 E(r)

A

51
New cards

After the first thread executes for one timeslice, which thread will get scheduled?

B

52
New cards

If threads A and B block, which thread will get scheduled?

C

53
New cards

Thread D unblocks. After one timeslice, which thread with get scheduled?

D

54
New cards

After one timeslice, which thread with get scheduled?

D

55
New cards

QNX Neutrino offers different forms of IPC. Which form is considered the faster?

Shared Memory

56
New cards

which of the following Neutrino commands will terminate a process named "looper" ?

/tmp $ ./looper

This process is in an infinite loop...

slay looper

57
New cards

Bad news .... man pages are not available from the Neutrino command line. Instead, you should use which command?

use

58
New cards

which function do you call to increment a semaphore?

sem_post()

59
New cards

Tapping "CTRL-C" together, at the same time, on your BYOD's keyboard results in which signal being sent?

SIGINT

60
New cards

Which of the following are valid actions for one-shot timers?

Pulse, signal, Create a new thread

61
New cards

When considering timers in QNX, the clock in QNX gives the number of seconds since which date?

The number of seconds since January 1, 1970

62
New cards

When a thread is created, it does not immediately execute, and it waits until it receives a signal to run

False

63
New cards

The Momentics IDE is based on which open-source IDE?

Eclipse

64
New cards

Which function returns the thread id (tid) of the current thread?

pthread_self()

65
New cards

A <blank> is composed of the following elements:
An address space
A program
The data
The required resources
Fill in the <blank>:
Thread
Shared Memory
Semaphore
Process
Channel

Process

66
New cards

Suppose you create a named semaphore by calling the sem_open() function. Which functionshould you call to destroy the semaphore?

sem_unlink()

67
New cards

Which function do you call to initialize the thread attributes?

pthread_attr_init()

68
New cards

What is the state of a child process if the parent process does not call wait()?

The child process becomes a zombie.

69
New cards

The shutdown CLI command shuts down and reboots QNX Neutrino. Which option shuts downNeutrino, but does not reboot?

-b

70
New cards

Can you install QNX Neutrino on a variety of hardware platforms?

True

71
New cards

Which function creates a named semaphore?

sem_open()

72
New cards

Which of these techniques would normally be used to allow a fixed number of threads (greater than two) to access a resource?

Semaphores

73
New cards

In QNX message passing, there is no requirement for the server to transfer any data back to the client. Which function would you call on the server to return no data back to the client?

MsgReply( rcvid, EOK, NULL, 0 );