16.2 How would you measure the time spent in a context switch? 上下文转换发生在两个进程之间,比如让一个等待进程进入执行和让一个运行进程进入等待,这些在多任务中发生.操作系统需要把等待进程的信息放入内存和把当前运行的进程信息保存下来.为了解决这个问题,我们记录在切换进程时的最后和第一个指令的时间点,比如我们有两个进程P1和P2,P1在执行P2在等待,当我们切换P1和P2时,假设发生在P1的第N个指令,我们用tx,k来表示进程x的第k个
自己写的一个方法 function split_time(time){//将当前时间转换成时间搓 例如2013-09-11 12:12:12 var arr=time.split(" "); var day=arr[0].split("-"); var hour=arr[1].split(":"); return Date.UTC(day[0],(day[1]-1),day[2],hour[0],hour[1],hour[2])