PDA

View Full Version : تغییر priority



oxygenws
پنج شنبه 29 مرداد 1383, 01:49 صبح
سلام،

باز هم من اومدم :)
آیا امکان این هست که در زمانی که یک فایل اجرا شده، priority اون رو تغییر بدیم؟؟

(توجه کنید که من نمی خوام یه پروسس جدید با فلان اولویت راه اندازی کنم)

ممنون،
موفق باشید، امید

Inprise
پنج شنبه 29 مرداد 1383, 11:22 صبح
بله عزیز برادر ؛

nice سطح تقدم پروسه های جدید و renice سطح تقدم پروسه های موجود رو مشخص میکنن . تابع ()nice و () setpriority نیز ایضا" اگر بخای کد بنویسی

موفق باشی

oxygenws
پنج شنبه 29 مرداد 1383, 12:24 عصر
ممنون برادر اینپی، بسیار عالی :)

پنج شنبه 29 مرداد 1383, 12:34 عصر
برادر اینپرایز یادتان هست که یه همچین سوال رو من درباره ی جاوا پرسیده بودم اما نشد و خود شما لینوکس اجلزه نمی دهد
پس اینجا جریان چیست؟ایا اونجا مشکل از جاوا بود؟
با تشکر

oxygenws
پنج شنبه 29 مرداد 1383, 13:16 عصر
برادر کیومرث، من حدس می زنم مشکل شما اینجاست که.....

هر کاربر (به جز super user) فقط می تونه اولویت برنامه های خودش رو تغییر بده، تازه اون هم فقط بین ۰ و ۲۰ :)
همونطور که احتمالا می دونی، اولویت -۲۰ بیشترین اولویت و ۲۰ کمترین هستش.
این هم خط به خط راهنمای renice (و البته nice):


Users other than the super-user may only alter the priority of processes
they own, and can only monotonically increase their "nice value" within
the range 0 to PRIO_MAX (20). (This prevents overriding administrative
fiats.) The super-user may alter the priority of any process and set the
priority to any value in the range PRIO_MIN (-20) to PRIO_MAX. Useful
priorities are: 20 (the affected processes will run only when nothing
else in the system wants to), 0 (the "base" scheduling priority), any-
thing negative (to make things go very fast).

موفق باشید، امید

Inprise
پنج شنبه 29 مرداد 1383, 13:23 عصر
برادر اینپرایز یادتان هست که ...

بله یادم هست . آیا یادت هست که اونجا در مورد Thread ها حرف میزدیم ؟ ایضا" یادته بحث در مورد Thread های جاوا بود ؟ :)

JDKی نسخهء لینوکس تغییر سطح تقدم ریسمانهای جاوا رو نادیده میگیره ( یه کلک هائی البته وجود داره ) چون برای تغییر این ویژگیها صرفا" کاربر باید مجوز مدیر سیستم رو داشته باشه ؛ این یه جورائی با فرهنگ لینوکس متناقضه . تو لینوکس این فقط و فقط و فقط مدیر سیستمه که باید/میتونه ویژگیهای خاص سیستم رو تغییر بده . ( خواهشا" از دید یک برنامه نویس به این مساله نگاه نکن ، چون مطمئنا" ابلهانه به نظر میاد )

موفق باشید

پنج شنبه 29 مرداد 1383, 19:12 عصر
از توضیحات جفتتون ممنون :D

hosseinzadeh
پنج شنبه 29 مرداد 1383, 21:15 عصر
4.3.5.1. Priority
The priority or importance of a job is defined by it's nice number. A program with a high nice number is
friendly to other programs, other users and the system; it is not an important job. The lower the nice number,
the more important a job is and the more resources it will take without sharing them.
Making a job nicer by increasing its nice number is only useful for processes that use a lot of CPU time
(compilers, math applications and such). Processes that always use a lot of I/O time are automatically
rewarded by the system and given a higher priority (a lower nice number), for example keyboard input always
gets highest priority on a system.
Defining the priority of a program is done with the nice command.
Most systems also provide the BSD renice command, which allows you to change the niceness of a running
command. Again, read the man page for your system−specific information.
Interactive programs
It is NOT a good idea to nice or renice an interactive program or a job running in the foreground.
Use of these commands is usually a task for the system administrator.

oxygenws
پنج شنبه 29 مرداد 1383, 21:50 عصر
It is NOT a good idea to nice or renice an interactive program or a job running in the foreground.


دلیل این جمله چیه؟؟

ممنون،
موفق باشید، امید