From: Subrata <sub...@us...> - 2008-02-22 14:44:37
|
Update of /cvsroot/ltp/ltp/testcases/realtime/func/prio-preempt In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv23978/ltp/testcases/realtime/func/prio-preempt Modified Files: prio-preempt.c Log Message: There are numerous cleanups, fixes and features went into our locally maintained version of realtime tests, since its intergration in LTP december last year. This patch merges those changes into LTP tree. The patch majorly contains : - All features, cleanups and fixes done by IBM realtime team over last two month or so. - Change in copyrights( year, symbil and limiting columns to 80 chars) - Other few cleanups to ltp-realtime tests. Signed-off-by : Sudhanshu Singh < su...@li...> Index: prio-preempt.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/realtime/func/prio-preempt/prio-preempt.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** prio-preempt.c 26 Dec 2007 11:11:50 -0000 1.1 --- prio-preempt.c 22 Feb 2008 14:43:57 -0000 1.2 *************** *** 1,5 **** /****************************************************************************** * ! * Copyright International Business Machines Corp., 2007 * * This program is free software; you can redistribute it and/or modify --- 1,5 ---- /****************************************************************************** * ! * Copyright © International Business Machines Corp., 2006, 2008 * * This program is free software; you can redistribute it and/or modify *************** *** 18,50 **** * * NAME ! * prio-preempt.c * * DESCRIPTION ! * Test whether priority pre-emption works fine. * * The main thread: ! * - Creates a minimum of (N-1) busy threads at priority starting at ! * SCHED_FIFO + 80 ! * - Creates 26 FIFO (T1, T2,...,T26) threads with priorities 10, 11,...,36. ! * - Each of these worker threads executes the following piece of code: ! * pthread_mutex_lock(Mi); ! * pthread_cond_wait(CVi); ! * pthread_mutex_unlock(Mi); * ! * where Mi is the ith pthread_mutex_t and CVi is the ith conditional variable. ! * So, at the end of this loop, 26 threads are all waiting on separate condvars ! * and mutexes. ! * - Wakes up thread at priority 10 (T1) by executing: ! * pthread_mutex_lock(M1); ! * pthread_cond_signal(CV1); ! * pthread_mutex_unlock(M1); * ! * - Waits for all the worker threads to finish execution. ! * T1 then wakes up T2 by signalling on the condvar CV2 and sets a flag called ! * T1_after_wait to indicate that it is after the wait. It then checks if ! * T2_after_wait has been set or not. If not, the test fails, else the process ! * continues with other threads. The thread T1 expects T2_after_wait to be set ! * as, the moment T1 signals on CV2, T2 is supposed to be scheduled (in ! * accordance with priority preemption). * * USAGE: --- 18,50 ---- * * NAME ! * prio-preempt.c * * DESCRIPTION ! * Test whether priority pre-emption works fine. * * The main thread: ! * - Creates a minimum of (N-1) busy threads at priority starting at ! * SCHED_FIFO + 80 ! * - Creates 26 FIFO (T1, T2,...,T26) threads with priorities 10, 11,...,36. ! * - Each of these worker threads executes the following piece of code: ! * pthread_mutex_lock(Mi); ! * pthread_cond_wait(CVi); ! * pthread_mutex_unlock(Mi); * ! * where Mi is the ith pthread_mutex_t and CVi is the ith conditional ! * variable.So, at the end of this loop, 26 threads are all waiting on ! * seperate condvars and mutexes. ! * - Wakes up thread at priority 10 (T1) by executing: ! * pthread_mutex_lock(M1); ! * pthread_cond_signal(CV1); ! * pthread_mutex_unlock(M1); * ! * - Waits for all the worker threads to finish execution. ! * T1 then wakes up T2 by signalling on the condvar CV2 and sets a flag ! * called T1_after_wait to indicate that it is after the wait. It then ! * checks if T2_after_wait has been set or not. If not, the test fails, ! * else the process continues with other threads. The thread T1 expects ! * T2_after_wait to be set as, the moment T1 signals on CV2, T2 is ! * supposed to be scheduled (in accordance with priority preemption). * * USAGE: |