home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3p / pthread_setconcurrency.z / pthread_setconcurrency
Encoding:
Text File  |  2002-10-03  |  4.9 KB  |  133 lines

  1.  
  2.  
  3.  
  4. pppptttthhhhrrrreeeeaaaadddd____sssseeeettttccccoooonnnnccccuuuurrrrrrrreeeennnnccccyyyy((((3333PPPP))))                          pppptttthhhhrrrreeeeaaaadddd____sssseeeettttccccoooonnnnccccuuuurrrrrrrreeeennnnccccyyyy((((3333PPPP))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      pthread_setconcurrency, pthread_getconcurrency - modify scheduling
  10.      concurrency
  11.  
  12. CCCC SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      ####iiiinnnncccclllluuuuddddeeee <<<<pppptttthhhhrrrreeeeaaaadddd....hhhh>>>>
  14.  
  15.      iiiinnnntttt pppptttthhhhrrrreeeeaaaadddd____sssseeeettttccccoooonnnnccccuuuurrrrrrrreeeennnnccccyyyy((((iiiinnnntttt lllleeeevvvveeeellll))));;;;
  16.  
  17.      iiiinnnntttt pppptttthhhhrrrreeeeaaaadddd____ggggeeeettttccccoooonnnnccccuuuurrrrrrrreeeennnnccccyyyy((((vvvvooooiiiidddd))));;;;
  18.  
  19. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  20.      Threads which are created with the PPPPTTTTHHHHRRRREEEEAAAADDDD____SSSSCCCCOOOOPPPPEEEE____PPPPRRRROOOOCCCCEEEESSSSSSSS attribute (which
  21.      is the default) [see _p_t_h_r_e_a_d__a_t_t_r__s_e_t_s_c_o_p_e()], are scheduled on a number
  22.      of kernel execution vehicles.  By default the number of execution
  23.      vehicles used is adjusted by the library as the application runs and is
  24.      called the concurrency level.  This is different from the traditional
  25.      notion of concurrency because it includes any threads blocked by the
  26.      application in the kernel (for example to do IO).  The library raises or
  27.      lowers the level to maintain a balance between user context switches and
  28.      CPU bandwidth.
  29.  
  30.      An application may choose to give the library a hint as to the best
  31.      concurrency level by using the _p_t_h_r_e_a_d__s_e_t_c_o_n_c_u_r_r_e_n_c_y() interface.  The
  32.      _l_e_v_e_l value indicates the concurrency that the application desires.  This
  33.      value will be used to compute the ideal number of execution vehicles for
  34.      scheduling PPPPTTTTHHHHRRRREEEEAAAADDDD____SSSSCCCCOOOOPPPPEEEE____PPPPRRRROOOOCCCCEEEESSSSSSSS threads.  If _l_e_v_e_l is zero the library
  35.      reverts to its default mode; adjusting the level itself.
  36.  
  37.      The _p_t_h_r_e_a_d__g_e_t_c_o_n_c_u_r_r_e_n_c_y() interface returns the current concurrency
  38.      level requested by _p_t_h_r_e_a_d__s_e_t_c_o_n_c_u_r_r_e_n_c_y() or zero if the default
  39.      concurrency mode is being used.
  40.  
  41.      Concurrency is a matter of performance not correctness; an application
  42.      will function correctly using the default mode.  However the result may
  43.      be overly conservative in its use of execution vehicles (and therefore
  44.      CPUs).  In this case performance may be improved by setting the
  45.      concurrency level explicitly.
  46.  
  47.      Conversely the library will not permit changes to the concurrency level
  48.      to create starvation.  Should the application set the concurrency level
  49.      to _n and then cause _n threads to block in the kernel the library will
  50.      activate additional execution vehicles as needed to enable other threads
  51.      to run.  In this case the concurrency level is temporarily raised and
  52.      will eventually return to the requested level.
  53.  
  54. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  55.      On success _p_t_h_r_e_a_d__s_e_t_c_o_n_c_u_r_r_e_n_c_y() returns zero; otherwise an error
  56.      number is returned:
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. pppptttthhhhrrrreeeeaaaadddd____sssseeeettttccccoooonnnnccccuuuurrrrrrrreeeennnnccccyyyy((((3333PPPP))))                          pppptttthhhhrrrreeeeaaaadddd____sssseeeettttccccoooonnnnccccuuuurrrrrrrreeeennnnccccyyyy((((3333PPPP))))
  71.  
  72.  
  73.  
  74.      [[[[EEEEIIIINNNNVVVVAAAALLLL]]]]       The value of _l_e_v_e_l is negative.
  75.  
  76.      _p_t_h_r_e_a_d__g_e_t_c_o_n_c_u_r_r_e_n_c_y() returns the current concurrency level (default
  77.      is zero).
  78.  
  79. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  80.      pthread_attr_setscope(3P).
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.