说明中断I/O方式和DMA方式有什么不同?
时间: 2023-12-14 20:39:42 浏览: 66
} while (choice != 0);
}
int main() {
readAdminFile();
readStudentFile();
readCourseFile();
中断I/O方式和DMA方式是两种不同的IO(输入/输出)数据传输方式。
中断I/O int choice;
do {
cout << "1.注册" << endl;
cout << "2.登录" << endl;
方式是指在CPU和I/O设备之间建立一个中断机制,当I/O设备需要进行数据传 cout << "0.退出" << endl;
cout << "请选择操作:";
cin >> choice;
switch (choice)输时,会向CPU发送一个中断请求信号,CPU接收到该信号后会暂停当前正在执行的 {
case 1:
registerUser();
break;
case 2:
if (login() == 1) {
程序,转而处理I/O设备的数据传输请求。在数据传输完成后,I/O设备再次向 adminMenu();
} else if (login() == 2) {
studentMenu();
} else {
cout << "CPU发送中断请求信号,CPU重新开始执行之前被中断的程序。
DMA方式是指在数据传输过登录失败!" << endl;
}
break;
case 0:
break;
default:
cout << "输入程中,由DMA控制器直接控制I/O设备和内存之间的数据传输,而无需有误!" << endl;
break;
}
} while (choice != 0);
return 0;
}
```