Unix™ Systems Programming [Electronic resources] : Communication, Concurrency, and Threads نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Unix™ Systems Programming [Electronic resources] : Communication, Concurrency, and Threads - نسخه متنی

Prentice Hall

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید










17.7 Concurrent Tasks


Modify the program to allow multiple computations and tasks. Use a MAX_TASKS value of 10 for this part. A new NEWTASK packet may come in before the data from previous tasks has been completely transmitted.

When a new NEWTASK packet comes in, find an available slot in the tasks object, create a new set of pipes, and fork a new child to execute the command. Don't enter any duplicates in the tasks array.

Figure 17.9 shows a schematic of a threaded NTPVM dispatcher that supports multiple simultaneous tasks. When another request comes in, the input thread creates a new output thread. Since multiple output threads write to standard output, define an additional mutex lock to synchronize output on the dispatcher's standard output.


Figure 17.9. Schematic of a threaded NTPVM dispatcher.



    / 276