Get Current->Pid While in Interrupt

get current-pid while in interrupt

You can, current->pid exists and is the process that was interrupted (may be the idle thread, or any).

If you're writing inside the Linux scheduler, you should be very careful. current is changed by the scheduler as it chooses a new process to run, so its value depends on when exactly you read it.

PID in case of irq context

It shows just a pid of a process that the IRQ preepmts.

You can imagine that:

  1. A process whose pid is 1001 is running.
  2. At that time, you press a key to raise an IRQ.
  3. The IRQ handler preempts the process whose current->pid is 1001.

There is NO RELATIONSHIP between current->pid and the IRQ

how to handle a long interrupt without freezing the system

I finally found a solution for this. It is filp_close()

flush_cache_all() ;             
close_result = filp_close(fdt->fd[i], NULL);

The whole system will not be frozen.
Thank you very much for your suggestions.
Regards

How to get the PID of matlab when using the MATLAB Engine?

Evaluate the following in MATLAB to get the PID:

feature('GetPid')

I found this here.



Related Topics



Leave a reply



Submit