The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+15 votes
1.9k views

Normally user programs are prevented from handling I/O directly by I/O instructions in them. For CPUs having explicit I/O instructions, such I/O protection is ensured by having the I/O instruction privileged. In a CPU with memory mapped I/O, there is no explicit I/O instruction. Which one of the following is true for a CPU with memory mapped I/O?

  1. I/O protection is ensured by operating system routine(s)

  2. I/O protection is ensured by a hardware trap

  3. I/O protection is ensured during system configuration

  4. I/O protection is not possible

asked in Operating System by Veteran (59.4k points) | 1.9k views
0
Please confirm this answer between options a) & b)      @Bikram sir
+3

@Tuhin

It is option A , is correct.

see this line 

Normally user programs are prevented from handling I/O directly by I/O instructions in them , For CPUs having explicit I/O instructions, such I/O protection is ensured by having the I/O instruction privileged.

this means explicit I/O is done at kernel mode , it can not done in user mode.

In a CPU with memory mapped I/O, there is no explicit I/O instruction so protection is ensured by operating system routines only . As in kernel mode only OS can handle the task . And Kernal mode deals with system calls. So option A is appropriate here ..

 

+1
@Tuhin datta trap is a software signal raised during errors in the code not for I/O SO B IS WRONG
0
@Bikram So in isolated IO, IO protection is ensured by hardware trap as in option B?

2 Answers

+26 votes
Best answer

option A. User applications are not allowed to perform I/O in user mode - All I/O requests are handled through system calls that must be performed in kernel mode

answered by Boss (13.5k points)
selected by
+1
How is I/O protection ensured by CPU having isolated mapped I/O?
+1
When it comes to memory mapped IO, a simple LOAD instruction can read the address range mapped to any IO device, right ? So if I am correct a non-IO instruction will be able to read from device. I agree with the above option, but the explanition does not seem correct
+4

Registered user 31  

Explanation given is correct too ..

From question , it is clear that user can not handle I/O execution.So I/O is perform at kernel mode only ..

  • The kernel  is a trusted software to OS, but all other programs are considered un-trusted software.
  • Thus, all user mode software must request use of the kernel by means of a system call in order to perform privileged instructions, such as process creation or input/output operations. 

Read https://gateoverflow.in/94643/user-and-kernel-mdoe

+1
User cannot handle I/O protection directly. It is handles by program (or routine) of OS
0 votes
B)

Since the IO instructions are not explicit in memory mapped IO, OS can't know just by seeing the instruction that whether it's an IO instruction or memory instruction. Thus when address space belongs to IO devices it triggers a hardware trap which makes the CPU aware that this is an IO instruction.
answered by Active (2.5k points)
0

A trap usually results in a switch to kernel mode, wherein the operating system performs some action before returning control to the originating process.. a type of synchronous interrupt typically caused by an exceptional condition .

Trap is more like an exception... so I/O protection can not be hardware trap.

Answer:

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

35,506 questions
42,827 answers
121,678 comments
42,181 users