首页 > 编程语言 >2022-2023-1 20221414《计算机基础和程序设计》第9周学习总结

2022-2023-1 20221414《计算机基础和程序设计》第9周学习总结

时间:2022-10-30 11:35:00浏览次数:63  
标签:return int 20221414 running state 2022 2023 进程 CPU

信息

作业 信息
这个作业属于哪个课程 班级
这个作业要求在哪里 要求
这个作业的目标 计算机科学概论第10,11章 并完成云班课测试《C语言程序设计》第8章并完成云班课测试

教材

  • 操作系统责任:管理计算机资源、为系统交互提供界面
  • 内存管理:了解主存中载有多少个程序以及它们的位置的动作
  • 进程管理:了解活动进程的信息的动作
  • CPU调度分两种类型和三种方法
    1.非抢先调度,发生在一个进程从运行状态切换到等待或者终止时(The amount of time between when a process arrives in the ready state the first time and when it exits the running state for the last time);
    2.抢先调度,发生在一个进程从运行到准备或者从等待到准备时(The operating system decides to favor another process, preempting the currently executing process)
    3.先到先服务:按到运行状态的顺序转移到CPU(Processes are moved to the CPU in the order in which they arrive in the running state)
    4.最短作业优先:查看所有处于准备状态的进程,从中挑选一个最短服务时间的进程转移到CPU(Process with shortest estimated running time in the ready state is moved into the running state first)
    5.轮询法:每个进程会被分配一个时间片,在这个时间片的时间段内,允许进程运行;如果在时间片结束时该进程还在运行,就会剥夺该进程得而CPU并分配给另一个进程;如果该进程在时间片结束前终止或者阻塞,则CPU会立即完成任务并进行切换。(Each process runs for a specified time slice(时间片) and moves from the running state to the ready state to await its next turn if not finished)

代码

#include<stdio.h>
#include<stdlib.h>
int s(int d);
int main()
{
int a, b, c;
scanf_s("%d", &a);
for (b = 1;; b++)
{
c = a - b;
if (s(b)==1&&s(c)==1)
{
printf("%d=%d+%d\n", a, b, c);
exit(0);
}
}
return 0;
}
int s(int d)
{
int i ;
for (i = 1; i <= d; i++)
{
if (d % i == 0 && d != i)
{
return 0;
}
else if (d % i == 0 && d == i)
{
return 1;
}
}
return 0;
}
素数函数错误。经调试,为循环起始出错,且判断素数的方式可优化,如下:
#include<stdio.h>
#include<stdlib.h>
int s(int d);
int main()
{
int a, b, c;
scanf_s("%d", &a);
for (b = 2;; b++)
{
c = a - b;
if (s(b) == 1 && s(c) == 1)
{
printf("%d=%d+%d\n", a, b, c);
exit(0);
}
}
return 0;
}
int s(int d)
{
int i;
for (i = 2; i < d; i++)
{
if (d % i == 0)
{
return 0;
}
}
return 1;
}

错题

1.Which of the following creates an object from a class?
A. Encapsulation(Encapsulation(封装),有时也叫隧道(tunneling),是将一个协议报文分组插入另一个协议报文分组。本地协议分组“背”着被封装的分组跨过本地协议网传输。)
B. Inheritance(继承)
C. Abstraction
D. Polymorphism(多态)
E. Instantiation(实例化是指在面向对象的编程中,把用类创建对象的过程称为实例化。)
正确答案:E
2.Pseudocode is an expression used as a condition in selection and repetition statements.
正确答案:错误
Pseudocode是伪代码。

代码行数(新增/累积) 博客量(新增/累积)
第九周 300/1800 1/15

标签:return,int,20221414,running,state,2022,2023,进程,CPU
From: https://www.cnblogs.com/20221414youer/p/16826367.html

相关文章

  • 2022年10月30日
      10月的最好几天,很想去三亚旅游,很想去看海,希望不久就可以实现。  10月的最后几天,希望开始新的人生,云游四海,行万里路,新的工作,新的人生,新的开始。  10月的最......
  • 2022-2023-1 20221311 《计算机基础与程序设计》第九周学习总结
    班级链接:https://edu.cnblogs.com/campus/besti/2022-2023-1-CFAP作业要求:https://www.cnblogs.com/rocedu/p/9577842.html#WEEK08作业目标:作业目标:学习计算机科学概论第1......
  • 2022.10.29每日一题
    DaimayuanOnlineJudge-01序列题目描述我们称一个字符串为好字符串,指这个字符串中只包含\(0\)和\(1\)。现在有一个好字符串,求这个字符串中\(1\)恰好出现\(k\)次......
  • 2022-2023 20221319《计算机基础与程序设计》第九周学习总结
    作业信息这个作业属于那个班级:https://edu.cnblogs.com/campus/besti/2022-2023-1-CFAP作业要求:https://www.cnblogs.com/rocedu/p/9577842.html#WEEK06作业目标:《计算......
  • 2022-2023-1 20221301 《计算机基础与程序设计》第九周学习总结
    2022-2023-120221301《计算机基础与程序设计》第九周学习总结作业信息这个作业属于哪个课程<班级的链接>https://edu.cnblogs.com/campus/besti/2022-2023-1-CFAP......
  • 河北省赛HBCPC2022补题
    赛时过了4道,D、H签到,F题贪心莫名卡了很久,M题用了线段树莫名过了,正解应该是用贡献度(But想不出来),赛后发现B题思路完全正确,就是没有时间写了:(,I题字符串也是一道简单dp(可惜看......
  • 2022-2023-1 20221427 《计算机基础与程序设计》第九周学习总结
    2022-2023-120221427《计算机基础与程序设计》第九周学习总结作业信息班级链接(2022-2023-1-计算机基础与程序设计)作业要求(2022-2023-1计算机基础与程序......
  • NISACTF2022--join-us(join using 无列名注入)
    join-us--join-using无列名查询访问登录页面,看到一个catugetflag输入框试试sql注入有报错信息  黑名单byupdatexmldatabaseunioncolumns=substr......
  • 【游记】重生之 CSP 2022 卷土重来
    CSP2022游记\(\text{Day}1\)前面到底是\(\text{Day}0\)还是\(\text{Day}-1\)??\(\text{Day}-2\)打了场模拟赛,感觉状态不错。总和之前的模拟赛经验,发现只要不被......
  • CSP-S 2022 游记
    坐标ZJ,每部分游记都会在后面标注时间。CSP-S1游记(writtenon2022/9/18):Day-inf~Day0:9.11时做了套初赛模拟还行,后面自己又做了一份也不错就直接没管。Day1:今......