INtime SDK Help
Processes
INtime SDK v7.1 > About INtime > INtime Kernel > Processes

Overview

An RT process consists of threads that use a shared address space called the memory pool. Threads in a process share resources to do their work. Because processes cannot share memory pools, a process isolates its threads and resources from other processes.

When you have threads and resources to isolate, create a separate process for them.

A process is an RT kernel object that contains threads and all their needed resources. Processes make up your INtime applications. INtime kernel processes:

Each INtime application's executable loads as a separate, loadable process. The processes in a system form a process tree. Each application process obtains resources from the root:



The RT Application Loader creates RT processes when an INtime application loads. There are system calls you can use to delete RT processes from within an application.

RT process hierarchy

RT processes are arranged in a hierarchy:


The RT Application Loader creates RT processes when an INtime application loads. There are system calls you can use to delete RT processes from within an application.

RT process types

The INtime kernel supports these process types:

Process type Description
Root process Created by the RT kernel at system initialization. All processes in the system descend from the root process.
System processes Created by the RT kernel at system initialization. System processes are child processes of the root process.
Loadable processes You can create applications as one or more loadable processes.

Your application probably contains more than one loadable process because you have threads and resources that need isolation. The number of processes depends on the complexity of the application and the modularity of your design.

RT process contents

A process can contain these resources:

Resource/object Description
Thread A thread of execution, typically identified as children of their parent process. Threads do the work of the system. A process may contain several threads. One is the initial thread created by the INtime kernel. The remainder are created by the initial thread. You group related threads in the same process.
Object directory A list of object names and handles which threads share with each other. You catalog objects in the object directory.
Memory pool A pool of memory that provides the memory that threads share and use to do their work within a process. Specify a process's memory pool size using the /HEAP parameter to the linker or loader parameters.
Shared memory area A page-aligned, contiguous sequence of bytes that threads use for any purpose. You must create and delete shared memory areas.
Mailbox Passes short data messages or handles between threads. The threads can be in different processes.
Message Queue Passes variable length data messages between threads. The threads can be in different processes.
Semaphore A counter that synchronizes threads.
Region A one-unit semaphore with special suspension, deletion and priority-adjustment features. Regions provide mutual exclusion. Only one thread can access a region at a time.
Exception handler Specifies what to do when a hardware, program, or environmental error occurs.

Each object you create uses an entry in the processor's GDT.

Creating an RT process

When you develop an RT application using the Microsoft Visual Studio, you specify the process's memory limits via Visual Studio settings (in INtime settings). If default values are given, when the RT Application Loader loads this application, it calculates suitable values for the process. The memory for the process is taken from the parent of the new process. In the case of INtime for WIndows that is the root process. In the case of INtime Distributed RTOS that is the INtime Runtime Loader process.

Applications can create another real-time process. Windows applications can call ntxCreateRtProcess. Real-time applications can call CreateRtProcess.

Specifying resources

The INtime kernel can manage up to 8000 system objects. Every object created by application processes count against this system object limit.

Each application process is created with an object directory which can hold, by default, up to 3840 objects.

The exception handler given each application process is the default system exception handler, which causes exceptions to be handled in line. (See Exception handling.)

The HEAP parameter specified in the generation of an RT application specifies initial and maximum memory pool size of the loaded process. You can also specify these values in the Advanced section of the RT Application Loader.

The initial thread

The RT Application Loader creates the initial thread for the new process. You program the initial thread to perform the initialization required when the process starts executing. You can program the initial thread to either delete itself or continue to exist as a regular thread, perhaps doing other housekeeping operations.

Deleting an RT process

Any thread in a process can delete its process (and thus itself) by using ExitRtProcess. A thread can attempt to delete another process by calling DeleteRtProcess.

Note: if a process uses the C library it should terminate by calling the C library exit() function rather than ExitRtProcess, in order to clean up the C library resources. The C library calls ExitRtProcess internally.
 

System Calls

This lists common operations related to processes and the RT kernel system calls that do the operations:

To . . . Use this system call . . .
Create a process CreateRtProcessCreateRtProcessExntxCreateRtProcess
Create a process on another node on the same host CreateRemoteRtProcess
Start a process which was created suspended StartRtProcessntxStartRtProcess
Wait for a previously-loaded process to exit and return the exit code to the caller. WaitForRtProcessWaitForRtProcessExntxWaitForRtProcess, ntxWaitForRtProcessEx
Delete the current process. ExitRtProcess
Delete a process DeleteRtProcess,  ntxDeleteRtProcess
Terminate a real-time process TerminateRtProcess,  ntxTerminateRtProcess
Get memory pool information about a process GetRtProcessPoolInfo
Set maximum priority of threads in process SetRtProcessMaxPriority
Release the application loader from waiting on the application. Called by a loaded process. SynchronizeRtLoader

This shows the order to make process system calls and lists calls that threads in processes frequently use:

Note:   For information about calls listed in the figure but not part of this topic, see Threads, Object directory, Distributed system management, Interrupts


 


 

  1. Make these calls from the initial thread.
  2. Make these calls from any thread in the process to register the process as either a dependency or sponsor.
  3. Make these calls from the process's interrupt threads.
  4. Make this call from any thread to receive notifications from the system or about a dependency.
  5. Make these calls from any threads in the process. Use calls that:
    • Create, catalog, manipulate, and delete objects.
    • Change a thread's priority or execution state.
    • Self-delete threads.
  6. Make these calls from any thread in the process to unregister the process as either a dependency or sponsor as part of clean-up.
  7. Make these calls from the initial thread or another housekeeping thread.

 

See Also