How to avoid the state of "S", when using matlab in ubuntu?

2 vues (au cours des 30 derniers jours)
Xiongwei
Xiongwei le 28 Août 2024
Commenté : Xiongwei le 29 Août 2024
When I run matlab script in ubuntu, I find that their states are "S" using "top" (touching figure). What should I do to avoid it?

Réponses (1)

Piyush Kumar
Piyush Kumar le 28 Août 2024
"S" indicates that the status of process is "Sleeping". It happens when a process is waiting for an event or resource.
Try "lsof" command to find out list of files opened by MATLAB. It can help you identify what a process is waiting for.
sudo lsof -p <PID>
You can get the <PID> of MATLAB process using top command output.
By examining the output, you can determine if MATLAB is waiting for a file or resource, which might be causing it to sleep.
For example, you might find a large text file. Suppose MATLAB is waiting for that to be available while the file is locked by another process. This can cause the MATLAB to go into sleep state as it will wait for the file to be available.
As a solution to avoid sleep state in above example, you will need to make sure that the text file is available and not locked by another process.
Let me know if this information helps you. If it does not help, please share the script which you are running.
  2 commentaires
Piyush Kumar
Piyush Kumar le 28 Août 2024
To see some processes with "R" status related to MATLAB,
  • Run an infinite loop in MATLAB command line
  • Run top command
  • Press "H"
By default, top shows a summary of all threads within each process. When you press H, it switches to show each thread separately, providing a more detailed view of what each thread is doing.
Xiongwei
Xiongwei le 29 Août 2024
Thanks for your reply. I have tried "top H" and found the "R" state.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Entering Commands dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by