Created
March 26, 2016 19:29
-
-
Save c0rp-aubakirov/ccc75941f5d757144d40 to your computer and use it in GitHub Desktop.
Алгоритм First Come First Served (FCFS) Простейшим алгоритмом является алгоритм First Come First Served (FCFS) – первым пришел, первым обслужен. Все запросы организуются в очередь FIFO и обслуживаются в порядке поступления. Пример. На диске из 100 цилиндров (от 0 до 99) есть следующая очередь запросов: 23, 67, 55, 14, 31, 7, 84, 10 и головки в н…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include<conio.h> | |
#include<math.h> | |
using namespace std; | |
int main() | |
{ | |
int a[10],b,n,c=0; | |
int i=0; | |
cout<<"vvedite nach znachenie golovki:"; | |
cin>>b; | |
a[0]=b; | |
cout<<"vvedite kolichestvo processov:"; | |
cin>>n; | |
cout<<"vvedite processy v poryadke zaprosov: "; | |
for(i=1;i<=n;i++) | |
{ | |
cin>>a[i]; | |
} | |
for(i=1;i<=n;i++) | |
{ | |
//вычисление расст | |
c+=abs(b-a[i]); | |
b=a[i]; | |
} | |
cout<<"obrabotka zaprosov:"; | |
cout<<a[0]<<" "; | |
for(i=1;i<=n;i++) | |
cout<<a[i]<<" "; | |
cout<<endl; | |
cout<<" itogo dvizhenie golovy = "<<c<<" cilindrov"; | |
getch(); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment