pthread_setschedprio

Имя

pthread_setschedprio — функция д ина м ического д оступа к пара м етра м планирования потока (REALTIME THREADS).

Синопсис

THRTPS #include <pthread.h>

int pthread_setschedprio(pthread_t thread, int prio);

Описание

Функция pthread_setschedprio () используется д ля установки приоритета планирования равны м значению, заданно м у пара м етро м prio, для потока, идентификационный но м ер (ID) которого задан пара м етро м thread.

В случае неудачного завершения функции pthread_setschedprio () приоритет планирования заданного потока останется без из м енения.

Возвращаемое значение

При успешно м завершении функция pthread_setschedprio () возвра щ ает нулевое значение; в противно м случае возвра щ ается код ошибки, обозначаю щ ий ее характер.

Ошибки

Функция pthread_setschedprio () м ожет завершиться неудачно, если:

[EINVAL] значение пара м етра prio не действительно для стратегии планирования заданного потока;

[ENOTSUP] была сделана попытка установить приоритет равны м значению, которое не поддерживается;

[EPERM] инициатор вызова не и м еет соответствую щ его разрешения на установку пара м етров стратегии планирования за д анного потока;

[EPERM] реализация не позволяет приложению м о д ифицировать приоритет, устанавливая его равны м за д анно м у значению;

[ESRCH] значение, за д анное пара м етро м thread, не относится к су щ ествую щ е м у потоку.

Функция pthread_setschedprio () не возвра щ ает ко д ошибки [EINTR].

Примеры

Отсутствуют.

Замечания по использованию

Отсутствуют.

Логическое обоснование

Функция pthread_setschedprio() обеспечивает для приложения воз м ожность вре м енно г о увеличения приоритета с последую щ и м ero понижение м без нежелательного побочного эффекта, выражае м ого в установке други м и потока м и такого же приоритета. Это нужно, если приложение должно реализовать такие собственные стратегии для ограничения инверсии приоритетов, как наследование приоритетов или использование предельных значений приоритетов. Эта воз м ожность особенно важна, если реализация не по д держивает опции Thread Priority Protection или Thread Priority Inheritance, но даже в случае их по д держки эту воз м ожность необходи м о использовать, если приложение обязано привязывать наследование приоритетов к использованию таких ресурсов, как се м афоры.

Нес м отря на то что, воз м ожно, предпочтительнее было бы решить эту пробле м у, м одифицируя спецификацию функции pthread_setschedparam(), было слишко м поздно вносить такое из м енение, поскольку уже су щ ествовали реализации, которые пришлось бы в это м случае из м енять. Поэто м у даннал функция и была введена.

Будущие направления

Отсутствуют.

Смотри также

pthread_getschedparam(), то м Base Definitions стандарта IEEE Std 1003.1-2001, <pthread. h>.

Последовательность внесения изменений

Функция впервые реализована в выпуске Issue 6. Включена в качестве реакции на интерпретацию IEEE PASC Interpretation 1003.1 #96.

СПИСОК ЛИТЕРАТУРЫ

1. Audi, Robert. Action, Intention, andReason. Ithaca, N. Y.: Cornell University Press, 1993.

2. Axford, Tom. Concurrent Programming: Fundamental Techniques for Real-Time and ParalMSoftwareDesign, Chichester, U. K.:JohnWiley, 1989.

3. Baase, Sarah. ComputerAlgorithms: Introduction to Design andAnalysis. 2nd ed. Reading, Mass.:Addison-Wesley, 1988.

4. Barfield, Woodrow, and Thomas A. Furnell III. Virtual Environments and Advanced InterfaceDesign. New York: Oxford University Press, 1995.

5. Binkley, Robert, Bronaugh, Richard, and Ausonio Marras. Agent, Action, andReason. Toronto: UniversityofToronto Press, 1971.

6. Booch, Grady, James Rumbaugh, and IvarJacobson. The Unified Modeling Language UserGuide. Boston: Addison-Wesley, 1999.

7. Bowan, Howard, andJohn Derrick. FormalMethods forDistributedProcessing: A Survey of Object-OrientedApproaches. NewYork: Cambridge University Press, 2001.

8. Brewka, Gerhard,Jurgen Diz, and Kurt Konolige. Nonmonotonic Reasoning. Stanford, Calif.: CSLI Publications, 1997.

9. Carroll, Martin D., and Margaret A. Ellis. Designing and CodingReusabh C++. Reading, Mass.: Addison-Wesley, 1995.

10. Cassell, Justine, Joseph Sullivan, Scott Prevost, and Elizabeth Churchill. Embodied ConversationalAgents. Cambridge, Mass.: MIT Press, 2000.

11. Chellas, Brian F. ModalLogic: An Introduction. New York: Cambridge University Press, 1980.

12. Coplien,James O. MuUi-Paradigm Design for C++. Reading, Mass.: Addison-Wesley, 1999.

13. Cormen, Thomas, Charles Leiserson, and Ronald Rivet. Introduction to Algorithms. Cambridge, Mass.: MIT Press, 1995.

14. Englemore, Robert, and Tony Morgan. BUickboard Systems. Wokingham, England: Addison-Wesley, 1988.

15. Garg, Vijay K. Principhs ofDistnbutedSystems. Norwell, Mass.: KluwerAcademic, 1996.

16. Geist, A1, Adam Beguelin, Jack Dongarra, Weicheng Jiang, Robert Manchek, and VaidySinderman. PVM:ParaUelVirtualMachine. London, England: MITPress, 1994.

17. Goodheart, Berny, andJames Cox. The Magic Garden ExpUiined: The Internak of Unix System VReUase4. New York: Prentice Hall, 1994.

18. Gropp, William, Steven Huss-Lederman, Andrew Lumsdaine, Ewing Lusk, Bill Nitzberg, William Saphir, and Marc Snir. MPI: The Compkte Reference. Vol. 2. Cambridge, Mass.: MIT Press, 1998.

19. Heath, Michael T. Scientific Computing: An Introduction Survey. New York: McGraw-Hill.

20. Henning, Michi, and Steve Vinoski. Advanced COBRA Programming with C++. Reading, Mass.: Addison-Wesley, 1999.

21. Hintikka,Jakko, and Merrill Hintikka. The Logic ofEpistemoU>gy and the EpistemoU>gy of LogTC.Amsterdam: KluwerAcademic, 1989.

22. Horty,John F. Agency andDeonticLogic. New York: Oxford University Press, 2001.

23. Hughes, Cameron, and Tracey Hughes. Mastering the Standard C++ CJmses. New York: JohnWiley, 1990.

24. Hughes, Cameron, and Tracey Hughes. Object-OrientedMuUithreading Using C++. New York:JohnWiley, 1997.

25. Hughes, Cameron, and Tracey Hughes. Linux Rapid Application Devebpment. Foster City, Calif.: M & T Books, 2000.

26. International Standard Organization. Information Technobgy: Portabk Operating System Interface. Pt. 1 System Application Program Interface. 2nd ed. Std 1003.1 ANSI/IEEE. 1996.

27. Josuttis, Nicolai M. The C++ Standard Boston: Addison-Wesley, 1999.

28. Koeing, Andrew, and Barbara Moo. Ruminations on C++. Reading, Mass.: Addison-Wesley, 1997.

29. Krishnamoorthy, C. S., and S. Rajeev. Artificial Intelligence and Expert Systems for Engineers. Boca Raton, Fla.: CRC Press, 1996.

30. Lewis, Ted, Glenn Andert, Paul Calder, Erich Gamma, Wolfgang Press, Larcy Rosenstein, and Kraus, Sarit. Strategic Negotiation in MuUitangent Environments. London: МГГ Press, 2001.

31. Luger, George F. ArtificialInteUigence. 4th ed. England: Addison-Wesley, 2002.

32. Mandrioli Dino, and Carlo Ghezzi. Theoretical Foundations of Computer Science. New York:JohnWiley, 1987.

33. Nielsen, Michael A., and Isaac L. Chuang. Quantum Computation and Quantum Information. New York: Cambridge University Press, 2000.

34. Patel, Mukesh J., Vasant Honavar, and Karthik Balakrishnan. Advances in the Evolutionary SynthesisofIntelligentAgents. Cambridge, Mass.: МГГ Press, 2001.

35. Picard, Rosalind. Affective Computing. London: MIT Press, 1997.

36. Rescher, Nicholas, and Alasdir Urquhart. Temporal Logic. New York: Springer-Verlag, 1971.

37. Robbins, Kay A., and Steven Robbins. Practical Unix Programming. Upper Saddle River, N.J.: Prentice Hall, 1996.

38. Schmucker, Kurt, Ander Weinand, andJohn M. VUssides. Object-OrientedApplication Frameworks. Greenwich, Conn.: ManningPublications, 1995.

39. Singh, Наггу. Progressing to Distributed Multiprocessing. Upper Saddle River, N.J.: Prentice Hall, 1999.

40. Skillicorn, David. Foundations of ParaUel Programming. New York: Cambridge University Press, 1994.

41. Soukup, Jiri. Taming C++: Pattern Ckisses and Persistence for Large Projects. Reading, Mass.:Addison-Wesley, 1994.

42. Sterling, Thomas L.,John Salmon, DonaldJ. Becker, and Daniel F. Savarese. How to Build a Bewoulf: A Guide to ImpUmentation and Application of PC Clusters. London: MITPress, 1999.

43. Stevens, Richard W. UNIX Network Programming: Interprocess Communications. Vol. 2, 2nd ed. Upper Saddle River: Prentice Hall, 1999.

44. Stroustrup, Bjarne. TheDesign andEvohUion of C++. Reading, Mass.: Addison-Wesley, 1994.

45. Subrahmanian, V.S., Piero Bonatti,Jurgen Dix, Thomas Eiter, Sarit Kraus, Fatma Ozcan, and Robert Ross. HeterogeneousAgentSystems. Cambridge, Mass.: МГГ Press, 2000.

46. Tel, Gerard. Introduction to Distributed Algorithms. 2nd ed. New York: Cambridge University Press, 2000.

47. Thompson, WilliamJ. ComputingforScientists andEngineers. New York:John Wiley, 1992.

48. Tomas, Gerald, and Christoph W. Uebeerhuber. Visualization of Scientific ParaUel Programming. New York: Springer-Verlag, 1994.

49. Tracy, Kim W. and Peter Bouthoorn. Object-Oriented: Artificial InteVigence Using C++. NewYork: ComputerScience Press, 1997.

50. Weiss, Gerhard. MultitagentSystems. Cambridge, Mass.: MFTPress, 1999.

51. Wooldridge, Michael. ReasoningAboutRationalAgents. London: MIT Press, 2000.

Больше книг — больше знаний!

Заберите 30% скидку новым пользователям на все книги Литрес с нашим промокодом

ПОЛУЧИТЬ СКИДКУ