<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Zheng,<div><br></div><div>The general structure of a typical litmus application looks like this:</div><div><br></div><div>init_litmus(); /* initialize litmus (basically just pins the programs memory to avoid page faults) */</div><div>set_rt_task_param(); /* set task params, such as period, relative deadline, execution time, etc. */</div><div>task_mode(LITMUS_RT_TASK); /* become a real-time task */</div><div>wait_for_ts_release(); /* wait for synchronous task set release—i.e., until liblitmus’s release_ts program is run */</div><div>while(running) { /* keep executing jobs until task should exit */</div><div> do_work(); /* do the actual work of a job */</div><div> sleep_next_period(); /* sleep until next job release */</div><div>}</div><div>task_mode(BACKGROUND_TASK); /* exit real-time mode */</div><div>exit(0);</div><div><br></div><div>You can take a look at liblitmus/bin/rtspin.c and liblitmus/bin/base_task.c for examples. (Note: Use of wait_for_ts_release() is optional. However, without it, you may want to swap the order of sleep_next_period() and do_work().)</div><div><br></div><div>The structure of your program is incorrect:</div><div><br></div><div>init_litmus();</div><div>set_rt_task_param();</div><div>task_mode(LITMUS_RT_TASK);</div><div>task_mode(BACKGROUND_TASK);</div><div>job();</div><div><br></div><div>Problems:</div><div>1) job() is not in a loop. (This would only be correct if you were doing real-time job shop scheduling.)</div><div>2) job() should be between task_mode(LITMUS_RT_TASK) and task_mode(BACKGROUND_TASK). You only need to call task_mode(LITMUS_RT_TASK) once per task, not once per job.</div><div><br></div><div>One last comment: It looks like you are reading the time stamp counter to trace start and finish times. This is fine in the correct context, but you can also use Litmus’s sched_trace logs to get more accurate information on job release times, completion times, and many other events. In general, you have to be careful measuring times in userspace. For instance, you cannot measure job release times in userspace because a job may not be immediately scheduled when it is released (there might be higher-priority work that needs to be scheduled first). Thus, a userspace release measurement would have an error of (time the job was first scheduled - true release time). It’s best if you use sched_trace logs to get accurate data.</div><div><br></div><div>-Glenn</div><div><br></div><div><br><div><div>On Nov 16, 2013, at 2:37 AM, Luo, Zheng <<a href="mailto:luozheng@wustl.edu">luozheng@wustl.edu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr" fpstyle="1" aria-label="Message body" tabindex="0" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div name="divtagdefaultwrapper" id="divtagdefaultwrapper" style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; margin: 0px;"><div style="margin-top: 0px; margin-bottom: 0px;"><span style="font-size: 12pt;">Hi All</span><span style="background-color: rgb(255, 255, 255); font-family: Helvetica, Verdana, sans-serif; font-size: 15.199999809265137px; font-weight: bold;">,</span></div><div dir="ltr" style="color: rgb(40, 40, 40);"><div name="divtagdefaultwrapper" id="divtagdefaultwrapper" style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; margin: 0px;"><div style="margin-top: 0px; margin-bottom: 0px;"><span style="background-color: rgb(255, 255, 255); font-family: Helvetica, Verdana, sans-serif; font-size: 15.199999809265137px; font-weight: bold;"><br></span></div><div><div style="margin-top: 0px; margin-bottom: 0px;"><font size="3">I am a master's student in Washington University who is doing research on realtime system. I installed Litmus because it has the global EDF scheduler. However when I do a simple experiment by using it. I simply can not get the right result. The EDF scheduler acts like a round robing scheduler. I don't know where I did wrong. The Litmus I installed is <span style="background-color: rgb(255, 255, 255);">LITMUS-RT Version 2013.1.</span></font></div><div style="margin-top: 0px; margin-bottom: 0px;"><br></div><div style="margin-top: 0px; margin-bottom: 0px;">I put my source code as a attachment, and also the screenshot of the result. Hope you can help me with. Thank you very much. Looking forward to your reply.</div><div style="margin-top: 0px; margin-bottom: 0px;"><br></div><div name="divtagdefaultwrapper" style="font-family: Calibri, Arial, Helvetica, sans-serif; margin: 0px;">Zheng Luo<br></div></div></div></div></div><span><Screenshot 2013-11-15 21:30:34.png></span><span><test_mt_task.c></span>_______________________________________________<br>litmus-dev mailing list<br><a href="mailto:litmus-dev@lists.litmus-rt.org">litmus-dev@lists.litmus-rt.org</a><br><a href="https://lists.litmus-rt.org/listinfo/litmus-dev">https://lists.litmus-rt.org/listinfo/litmus-dev</a></div></blockquote></div><br></div></body></html>