Managing Thread Priorities in Java, POSIX, and C++11

se3910 real time systems n.w
1 / 20
Embed
Share

Learn how to set thread priorities in Java, manage execution with POSIX thread priorities, and work with thread priorities in C++11. Explore code examples and explanations for each method.

  • Java Threads
  • POSIX
  • C++11
  • Thread Priorities

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. SE3910 REAL TIME SYSTEMS Thread Priorities Slide Style & Content: Dr. Schilling More Content: Dr. Yoder

  2. Explain how to set thread priority in Java. Construct code which sets thread priority in Java. Explain how to set the thread priorities in POSIX Construct code which uses POSIX thread priorities to manage execution OBJECTIVES Explain how one sets thread priorities using C++11 threads. SE3910 REAL TIME SYSTEMS

  3. Java java.lang.Thread No external jar needed Thread t = new Thread(r) t.start(); interface Runnable { void run(); } t.join(); Object o; synchronized(o) { } /* Garbage coll. */ Pthreads #include <pthread.h> link with -pthread pthread_create(t,r,sr,a) THREADING PTHREADS Parameter: void* (*sr) (void *) pthread_join(*t, &p) pthread_mutex_init(m,null) pthread_mutex_lock( ) pthread_mutex_destroy( ) (REVIEW) 3

  4. Java Object o; o.notify(); o.wait(); o.notify(); o.notifyAll(); pthreads phread_cond_t c = PTHREAD_COND_INITIALIZER; pthread_cond_broadcast(c); pthread_cond_wait(c,m); phtread_cond_signal(c); phtread_cond_broadcast(c); THREADING PTHREADS (UPDATED) SE-3910 - DR. JOSIAH YODER SLIDE STYLE: DR. HORNICK MUCH MATERIAL: DR. SCHILLING 4

  5. Java java.lang.Thread No external jar needed Thread t = new Thread(r) t.start(); interface Runnable { void run(); } t.join(); qthreads #include <QThread> THREADING QTHREADS (qmake, moc and friends take care of this) QThread *q = new QThread; moveToThread(o); QObject (e.g. QWidget (e.g. QMainWindow)) connect the QThread::finish() signal to a slot that checks if all threads are done. QMutex Avoid sharing memory entirely Object o; synchronized(o) { } /* Garbage coll. */ ???? 5

  6. INTO QT SLOTS/SIGNALS == A QThread should be used much like a regular thread instance: prepare an object (QObject) class with all your desired functionality in it. Then create a new QThread instance, push the QObject onto it using moveToThread(QThread*) of the QObject instance and call start() on the QThread instance. That s all. EVENTS https://mayaposch.wordpress.com/2011/11/01/how-to-really-truly- use-qthreads-the-full-explanation/ I have used this approach this is what the example QtPrimeApp (or something like that) does SE-2811 DR.YODER 6

  7. C++11 THREADS http://indico.cern.ch/event/199138/session/6/contribution/20/material/paper/0.pdf SE3910 REAL TIME SYSTEMS

  8. C++11 THREADS SE3910 REAL TIME SYSTEMS

  9. THE INTEGRATION THREAD SE3910 REAL TIME SYSTEMS

  10. RESULTS SE3910 REAL TIME SYSTEMS

  11. How do you set the thread priority in Java? JAVA THREADS SE3910 REAL TIME SYSTEMS

  12. SE3910 REAL TIME SYSTEMS

  13. PTHREADS PRIORITY SCHEDULING SE3910 REAL TIME SYSTEMS

  14. PTHREAD AFFINITY SE3910 REAL TIME SYSTEMS

  15. PTHREAD PRIORITY QUEUES SE3910 REAL TIME SYSTEMS

  16. SCHEDULING POLICY SE3910 REAL TIME SYSTEMS

  17. SCHEDULER SE3910 REAL TIME SYSTEMS

  18. SETTING ATTRIBUTES SE3910 REAL TIME SYSTEMS

  19. PTHREAD INHERITANCE SE3910 REAL TIME SYSTEMS

  20. EXAMPLE SE3910 REAL TIME SYSTEMS

More Related Content