Testing priorities in IceE

YosYos Member Jose FernandezOrganization: University of Malaga (Spain)Project: Comparision between Ice VS Corba
Hi,

I'm trying to find documentation and/or examples to use ICE-E with priorities.

Can you tell where can i find this?

Another question:


How is the mapping between the ICE-E priorities and the native priorities of OS, like windows for example?

Thanks

Comments

  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Jose,

    You can find the documentation for thread priority support in Ice-E (and other related features) in the Ice-E README file:
    http://www.zeroc.com/download/IceE/1.3/README.txt

    (see 3. Real-Time Features)

    Ice-E does not define an abstract priority mapped to OS priorities; the priority value/parameter is system-dependent.

    Best regards,
    Bernard
  • YosYos Member Jose FernandezOrganization: University of Malaga (Spain)Project: Comparision between Ice VS Corba
    Testing priorities in IceE

    Hello,

    I'm testing priorities with IceE in Windows XP, i have used the properties Ice.ThreadPool.Client.ThreadPriority and Ice.ThreadPriority, i have assigned different priorities to few clients, values of this property in th order of execution (2,1,2,0,1,2,1). However the order of execution is the same from the beginning to the end, i have two questions:

    Is possible that in this enviroment, windows XP and IceE, a client with priority 2 finish the execution before other with priority 1 (or vicerversa, i don't know i is more important with a priority minor or major)??

    When I try to assing a priority bigger than 2 thrown an error. Only is possible set three priorities for all process 0,1 or 2?
  • YosYos Member Jose FernandezOrganization: University of Malaga (Spain)Project: Comparision between Ice VS Corba
    another way to ask

    Hi again,

    Maybe my question wasn't good expressed

    Is possible to check the thread priorities using IceE in Windows XP or is obligatory at least use an operative system like linux?

    are there more options to use the thread priorities in IceE or the only options are the properties known?

    Ice.ThreadPool.Client.ThreadPriority
    Ice.ThreadPool.Server.ThreadPriority
    Ice.ThreadPriority
    adapter.ThreadPool.ThreadPriority

    Why is thrown an exception when i assigned a priority bigger than 2 to the property?

    Any answer will be grateful.

    Best regards.
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,
    Is possible that in this enviroment, windows XP and IceE, a client with priority 2 finish the execution before other with priority 1 (or vicerversa, i don't know i is more important with a priority minor or major)??
    Windows XP has not real time thread support so there is any warranty about schedule order. In systems with real time support the scheduler has some warranty order, see README in IceE for details.
    Why is thrown an exception when i assigned a priority bigger than 2 to the property?

    You should pass native thread priorities

    see here for the list of threads priorities for Windows SetThreadPriority Function (Windows)

    Cheers,
    José
  • YosYos Member Jose FernandezOrganization: University of Malaga (Spain)Project: Comparision between Ice VS Corba
    priorities

    Hi,

    I'm using the last version of IceE and Windows XP
    I know that the priority is system-dependant but when i use the properties in IceE: Ice.ThreadPool.Client.ThreadPriority, Ice.ThreadPool.Server.ThreadPriority, Ice.ThreadPriority or adapter.ThreadPool.ThreadPriority. I only can set the values 0,1 or 2.

    I have read that XP has 2 classes of priorities, the first or normal 1-15 and the second or real-time with values 16-31. Inside of them there are sublevels (time-critical, highest,Above-normal, below_normal,lowest and idle). I have some questions:

    If I set the values of property Ice.ThreadPool.... to 1 or 2 (i think that 0 is without priority) which will be the priority that the O.S. XP will assign to this thread?

    Do i need to use a library from the O.S. to set a priority to the current thread? or
    when i set the property Ice.ThreadPool.Client.ThreadPriority=2 ICE-E automatically is able to say to the O.S. that this thread i more important that another with Ice.ThreadPool.Client.ThreadPriority set with value 1?

    If I need a new library from the O.S. to set the priority what is the purpose of this property?

    Has it any utility really? Maybe in other O.S?

    In this case which is its behaviour in linux with forty priorities from -20 to 19?

    An example of my mind....sure is false but is only try to understand?
    The value 1 corresponds from -20 to -1
    The value 0 corresponds to 0
    The value 2 corresponds from 0 to -19

    Sorry for my insistence but is the last issue of my job and i need to understand this.

    If you have any documentation about this please tell me where, because I have searched it but i can`t find anything.

    thank you
  • YosYos Member Jose FernandezOrganization: University of Malaga (Spain)Project: Comparision between Ice VS Corba
    Result of use priorities in XP

    Hi,

    Finally i have used the priorities with Ice-E in XP with this code:

    ...
    int priorityValue;
    int classPriorityValue;
    HANDLE hThread;
    hThread=GetCurrentThread();
    priorityValue=GetThreadPriority(hThread);
    classPriorityValue=GetPriorityClass(GetCurrentProcess());
    contador++;
    printf("Iteracion==>%d--Valor==>%d--Clase==>%d\n",
    contador,priorityValue,classPriorityValue); fflush(stdout);
    twoway->sayHello(delay);
    ...

    This program read the properties from the file config where i change the value of property Ice.ThreadPriority for each execution (0,1,2). Moreover I use the others properties to set the priorities Ice.ThreadPool.Client.ThreadPriority and adapter.ThreadPool.ThreadPriority and execute another clients with different values but the out is ever the same:

    Iteracion==>1--Valor==>0--Clase==>32
    Iteracion==>2--Valor==>0--Clase==>32
    Iteracion==>3--Valor==>0--Clase==>32
    Iteracion==>4--Valor==>0--Clase==>32 (All the execution the same out)

    If all threads have the same priority and the same priority-class is impossible that the priorities affect.

    Why dont the properties have effect on these process?:confused: :confused:

    maybe am i doing anything bad? or I will not never change the priority of a thread using these properties. :(
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Jose,

    You may want to look at the Ice-E source code. As I wrote above, Ice-E does not perform any translation of priority values. For example, on Windows, the priority value you pass to your IceUtil::Thread is passed directly to the underlying Windows SetThreadPriority function:

    SetThreadPriority Function (Windows)

    Best regards,
    Bernard
  • YosYos Member Jose FernandezOrganization: University of Malaga (Spain)Project: Comparision between Ice VS Corba
    Hi Bernard, tks for the answer but appears new doubts ( these are the last ;) )

    I think that im doing something bad to get threads with different priorities, because i set the property

    Ice.ThreadPriority=0
    Ice.ThreadPriority=1
    Ice.ThreadPriority=2

    in different clients and when i get the priority with GetThreadPriority(GetCurrentThread()); always is the same return value
    "0" THREAD_PRIORITY_NORMAL
    and if the value of this property is passed directly to SetThreadPriority(hthread, priority) windows function the result when i call to
    GetThreadPriority(GetCurrentThread()) should be

    "0" THREAD_PRIORITY_NORMAL when Ice.ThreadPriority=0
    "1" THREAD_PRIORITY_ABOVE_NORMAL when Ice.ThreadPriority=1
    "2" THREAD_PRIORITY_HIGHEST when Ice.ThreadPriority=2

    Maybe should i do anything else? is there another way to assign the priority to the threads?

    Maybe this property only has effect in new threads created and not in the main thread?

    If Ice-E doesn`t perform any translation of priorities. The process is the same in all OS's, Ice pass the value of this property (Ice.ThreadPriority and others related prorperties) directly to the O.S. function that is manager to set the priority of the threads?

    Best Regards, and thank you very much Bernard.
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Jose,

    If you do all this in the main thread, these results are expected: Ice/Ice-E only changes the priority of the threads it creates.

    For the main thread, or any thread you create yourself, Ice.ThreadPriority has no effect.

    Best regards,
    Bernard
  • YosYos Member Jose FernandezOrganization: University of Malaga (Spain)Project: Comparision between Ice VS Corba
    So, the programmer never can set different priorities at his process? Is true?

    In this case can you tell me a little example that Ice/Ice-E creates new threads?


    thanks.
  • YosYos Member Jose FernandezOrganization: University of Malaga (Spain)Project: Comparision between Ice VS Corba
    Ok i got it ¡¡¡ :) .

    I set the property in 3 servers with different values because the server creates different threads for each dispatch. and the server print out the priorities different.

    thank you for all Bernard,

    Best regards.
Sign In or Register to comment.