There was a question about such processes. The theory about them seems to be understood, but one thing is not clear, namely the number of copies of each process.

Does the periodic process (which starts with some frequency) have one instance or is a new instance created for each period of execution ?

Those. Let us have a program:

printf("Hello world! %ld", getpid()); 

Then with a given frequency we will see:

Hello world! 123

Hello world! 125

Hello world! 127

The same question about aperiodic processes. As I understand it, only one copy is created, and it will "live" until it finishes its execution?

Those. the same piece of code will give us the following:

Hello world! 253

Is my judgment correct, that a periodic process is many instances, and aperiodic is one instance?

Interested in RTOS!

  • Well, obviously, every time the process starts , this is a new process. - VladD
  • five
    And what do you mean by periodic and non-periodic processes? - VladD
  • @VladD This is something from radio engineering ... - Roman
  • @VladD, a periodic process is a process that has a start-up period and a deadline, we can also calculate when it will start (we know the period), I have two options: 1) one process starts, then when approaching the deadline, the process is superseded or just falls asleep, then when the period approaches, the process resumes or wakes up. 2) for each period, a separate process instance is launched, i.e. It must be guaranteed that the deadline process will perform all the necessary operations. Aperiodic process can start at any time. - rinatdobr
  • one
    And then, what does “artificial” mean and what are “normal processes”? Do not really understand. All of them are just processes and just system calls. - avp 8:01 pm

1 answer 1

In modern operating systems, there are no concepts of periodic and aperiodic processes. You can, however, consider a process to be periodic if it starts with some specific period, for example, using subsystems such as cron or anacron (for occasionally shutting down systems, such as desktops).

In all cases when the process is restarted (and this is what happens when the process is executed periodically by the cron ), it receives a new PID.

Update 1.

As for real-time systems, this question here acquires a completely different sound. In the theory of real-time operating systems (RTOS), periodic and aperiodic tasks are distinguished. A periodic task is one that is performed in accordance with a well-known timetable and imposes strict restrictions on the execution time (hard deadlines). In contrast, aperiodic tasks are performed at a predetermined time and can impose both hard and soft execution time requirements (soft deadlines and hard deadlines).

How exactly the process will live, whether it will be restarted or just get control at a certain time, may depend on the implementation and is not determined in theory as such, but in all implementations that I know of at the present time, the process does not end, execution occurs within one process , it is simply postponed until its next launch is required.

For example, here’s how a periodic task is implemented in FreeRTOS:

  // Perform an action every 10 ticks. void vTaskFunction( void * pvParameters ) { TickType_t xLastWakeTime; const TickType_t xFrequency = 10; // Initialise the xLastWakeTime variable with the current time. xLastWakeTime = xTaskGetTickCount(); for( ;; ) { // Wait for the next cycle. vTaskDelayUntil( &xLastWakeTime, xFrequency ); // Perform action here. } } 

Source: FreeRTOS Scheduler API Documentation , vTaskDelayUntil

As you can see from the example, execution takes place within the framework of a single process.

  • Thank you for the answer, but the common operating systems do not interest me, added a question that RTOS is being considered - rinatdobr
  • @rinatd: Watch the update - Igor Chubin
  • Thanks for the answer, did not expect that it depends on the implementation of the OS. - rinatdobr