Exercise 1 Doubt

Beiträge: 1
Registriert: 25. Nov 2015 17:46

Exercise 1 Doubt

Beitrag von ksaurabh.02 »

I was going through 1st exercise question and for the following question I am confused.

3. Which of the following instructions should be allowed only in kernel mode?
(a) Disable all interrupts
(b) Set time-of-day clock
(c) Change the memory map

For the option b i.e Set time of day clock , answer during the exercise was discussed as User mode, but isn't setting time of day is done by kernel mode?
AFAIK user can only read the time it cannot set the time, it is done in kernel mode only. Am I correct?

Beiträge: 1
Registriert: 21. Okt 2015 23:54

Re: Exercise 1 Doubt

Beitrag von sj17relo »

Disable all interrupts: This can only be done in kernel mode. Interrupts are used in context switches or to notify the system when retrieving data from the hard disk.
Set time-of-day clock: Kernel only, could affect scheduling, other processes, and the kernel.
Change the memory map: This can only be done in kernel mode. If you do it in user mode, a process could overwrite another process’ (or the kernel’s) memory.

Beiträge: 8
Registriert: 3. Dez 2014 13:31

Re: Exercise 1 Doubt

Beitrag von sumitsati »

Short answer: both are correct. Setting time of day clock can be a kernel mode instruction or user mode instruction. It depends notion of "time of day clock".

Long answer: I hope First and third are obvious. Disabling interrupts and changing memory map should be allowed in kernel mode only. Now for setting time of day clock answer varies as per the notion of the clock you are taking. Two notion can be taken: first one is, there is only one clock in the system and this clock is used for both display of time to user application and also used for internal purpose by the kernel, such as scheduling events, timers etc. . If this is the case user mode shouldn't have access to setting time of day clock so as to safeguard the disastrous effects it will otherwise have on the system.
However if you consider this clock as different from the one used by system for its internal purposes, as is the case with all/nearly most of the commodity operating systems, then time of day clock isn't used by the system for general upkeep and is different from system clock. Now this can be done in user-mode, may be sometimes with privileged users only, so as not to make it problematic for other users or because of other policy restrictions cases.
Hope it helped.



Zurück zu „Archiv“