% This is a disk array simulator, which simulates a parallel disk array consisting of DISK_NUM indepdendent&homogeneous disks. 
% Author: Tao Xie, 01/27/2007, San Diego State University, Computer Science Department,
% 4 algorithms are implemented in this simulator:
% 1. Greedy; 2. Sort Partition (SP); 3. Hybrid Partition (HP); 4. Sor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Greedy file allocation algorithm:
%  Input: DISK_NUM = number of disks
%         FILE_NUM = number of files
%         hi = heat of file i; && heat of a file = the file's access rate * the access service time
%         si = expected service time of file i;
%  Output: assignment of files to disks {I1, I2, ..., Im} && m=DISK_NUM
%  Step 1: Compute the average disk utilization Ave_utilization=1/DISK_NUM* total heat of all the FILE_NUM files' heats;
%  Step 2: Allocate to each disk dj the next contiguous segment of I until its load, loadj, reaches the maximum allowed level Ave_uitlization;
%          i=1;
%          for j=1 to DISK_NUM do
%              loadj=0; Ij=empty;
%              while (loadj <= Ave_utilization and i <= FILE_NUM) do 
%                    Ij=Ij U {i};
%                    loadj=loadj+hi;
%                    i=i+1;
%              endwhile
%          endfor
%          if (i <= n) then
%              Im=Im U {i, i+1, ..., FILE_NUM);
%          endif
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Sort Partition file allocation algorithm (SP):
%  Input: DISK_NUM = number of disks
%         FILE_NUM = number of files
%         hi = heat of file i; && heat of a file = the file's access rate * the access service time
%         si = expected service time of file i;
%  Output: assignment of files to disks {I1, I2, ..., Im} && m=DISK_NUM
%  Step 1: Compute the average disk utilization Ave_utilization=1/DISK_NUM* total heat of all the FILE_NUM files' heats;
%  Step 2: Sort all files into list I in descending order of their service times si;
%  Step 3: Allocate to each disk dj the next contiguous segment of I until its load, loadj, reaches the maximum allowed level Ave_uitlization;
%          i=1;
%          for j=1 to DISK_NUM do
%              loadj=0; Ij=empty;
%              while (loadj <= Ave_utilization and i <= FILE_NUM) do 
%                    Ij=Ij U {i};
%                    loadj=loadj+hi;
%                    i=i+1;
%              endwhile
%          endfor
%          if (i <= n) then
%              Im=Im U {i, i+1, ..., FILE_NUM);
%          endif
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Hybrid Partition file allocation algorithm (HP):
%  Input: DISK_NUM = number of disks
%         FILE_NUM = number of files
%         hi = heat of file i; && heat of a file = the file's access rate * the access service time
%         b = number of sorted batches of files
%         Bi = i-th batch of files sorted in descending order of service times
%         B = list (B1, B2, ..., Bb)
%  Output: assignment of files to disks {I1, I2, ..., Im} && m=DISK_NUM
%  Step 1: Initialize the load on each disk di: loadi=0 and set allocation list Ii=empty;
%  Step 2: while (list of batches B has not been exhausted) do
%                Select next batch Bnext not yet assigned;
%                while (Bnext has not been completely assigned) do
%                       Determine the next disk, dk, to be used during the next allocation interval, L:
%                       dk = disk such that loadk=min s=1,...,DISK_NUM (loads);
%                       Determine the threshold Tk to which the load can be
%                       increased on disk dk during this interval:
%                       Tk = 1 - (1-loadk)/overflow         && overflow is a constant
%                       During allocation interval L assgin to disk dk a contiguous segment of files from Bnext until its load reaches threshold Tk;
%                       Update the allocation list Ik;
%                       Ik = Ik U {indices of files allocated in interval L};
%                endwhile
%          endwhile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function sead_simulator(DISK_NUM, correlation_type)
% sead_simulator accepts two input parameters
%     The first one is the number of disks in the simulated disk array. The second one is the correlation types between file size and file access rate: 
%     1 -- The distributions of access rates across the files and file sizes were inversely correlated; 2 -- The size of files obeys a
%     Standard Uniform Distribution and has NOTHING to do with the access rate distribution; 3 -- The size of files obeys a Standard Normal
%     Distribution and has NOTHING to do with the access rate distribution. 4 -- The size of files obeys a Standard Exponential Distribution and
%     has NOTHING to do with the access rate distribution.
load sead_workload;
start_time=cputime,
HIGH_SPEED=31;  %% The high speed for a two-speed hard disk is set to 31 MBytes/second. These parameters come from Pinheiro's paper. We assume that disks always use high speed to serve requests.
LOW_SPEED=9.3;  %% The low speed for a two-speed hard disk is set to 9.3 MBytes/second.
BATECH_NUM=4;   %% There are BATCH_NUM batches in the entire file set. This constant is only used by the HP algorithm.
File_heat=repmat(0,1,FILE_NUM);
File_size=repmat(0,1,FILE_NUM);
Disk_idle=repmat(0,REQUEST_NUM,3);
Performance_matrix=repmat(0,5,6);     
% The Performance_matrix matrix is used to show the performance of the three algorityms.
% Five rows represent the 5 algorithms: 1.Gready; 2.SP; 3. HP; 4. SEAD; 5. BEAD.
% Five columns are: 1. Mean Response Time; 2. Total Energy Consumption; 3. Mean Disk Utilization; 4. Standard Deviation of Disk Utilization; 
% 5. Standard Deviation of Disk Energy Consumption; 6. Slowdown ratio (the slowdown of a request is the ratio of the request’s response time to its service time and the slowdown ratio is 
% the average value of all requests’ slowdowns). 

% logical_start_time is zero and it's the time we start to calculate energy consumption for each disk; 
% logical_finish_time is the latest finish time among all requests and it is the time instance for us to stop calculating energy consumption for each disk. 
% In other words, we calculate energy consumption for each disk ONLY within this logic time span (the time span=logical_finish_time - logical_start_time).
logical_start_time=0;
logical_finish_time=0;
load sead_workload;
switch correlation_type
    case 1, %% The distributions of access rates across the files and file sizes were inversely correlated (like the Fig.6 in Lee's paper);
        i=1;
        while i <= FILE_NUM
            File_heat(i)=File_attribute(i,2)*(File_attribute(i,4)/HIGH_SPEED);
            File_size(i)=File_attribute(i,4);            
            i=i+1;
        end
    case 2, %% The size of files obeys a Standard Uniform Distribution and has NOTHING to do with the access rate distribution.
        i=1;
        while i <= FILE_NUM
            File_heat(i)=File_attribute(i,2)*(File_attribute(i,5)/HIGH_SPEED);
            File_size(i)=File_attribute(i,5);            
            i=i+1;
        end
    case 3, %% The size of files obeys a Standard Normal Distribution and has NOTHING to do with the access rate distribution.
        i=1;
        while i <= FILE_NUM
            File_heat(i)=File_attribute(i,2)*(File_attribute(i,6)/HIGH_SPEED);
            File_size(i)=File_attribute(i,6);            
            i=i+1;
        end
    case 4, %% The size of files obeys a Standard Exponential Distribution and has NOTHING to do with the access rate distribution.
        i=1;
        while i <= FILE_NUM
            File_heat(i)=File_attribute(i,2)*(File_attribute(i,7)/HIGH_SPEED);
                        File_size(i)=File_attribute(i,7);            
            i=i+1;
        end
    otherwise, %% All other parameters for "correlation_type" are wrong!
        fprintf( '\n Unknown correlation type name! \n');
        return;
end
xx=1;
%%%%%%%%%% Beginning of the Greedy file allocation algorithm implementation %%%%%%%%%% 
% Step 1: Compute the average disk utilization Ave_utilization=1/DISK_NUM* total amount of all the FILE_NUM files' heats;
Ave_utilization=sum(File_heat)/DISK_NUM;
Real_Ave_utilization=Ave_utilization; % I use this average utilization to distribute file so that the last disk is always hungry can be avoided.
I=randperm(FILE_NUM);  %% I is a randomized array that contains the ID of the FILE_NUM files.
%  Step 2: Allocate to each disk dj the next contiguous segment of I until its load, loadj, reaches the maximum allowed level Ave_uitlization;
disk_load=repmat(0,1,DISK_NUM);
file_disk=repmat(0,1,FILE_NUM); %% This array is used to record: for each file, which disk it is assigned onto.
I_disk=repmat(0,DISK_NUM,FILE_NUM);
i=1;
k=1;
for j = 1:DISK_NUM
    current_load=disk_load(j); 
    k=1;
    next_load=current_load+File_heat(I(i));    
    while (next_load <= Ave_utilization) && (i <= FILE_NUM)
        I_disk(j,k)=I(i);
        file_disk(I(i))=j;
        current_load=next_load;
        i=i+1;
        next_load=current_load+File_heat(I(i));            
        k=k+1;
    end
    disk_load(j)=current_load;
end
%% heat_left=0; for debug
if (i <= FILE_NUM) 
    while i <= FILE_NUM
        I_disk(DISK_NUM,k)=I(i);
        file_disk(I(i))=DISK_NUM;        
        disk_load(DISK_NUM)=disk_load(DISK_NUM)+File_heat(I(i));        
        k=k+1;
        i=i+1;
%% heat_left=heat_left+File_heat(I(i)); for debug
    end
end
% Step 3: Calculate mean response time and overall energy consumption for the Greedy algorithm

% The followings are characteristics and simulated power, energy, and time for our two-speed disk. This parameters come from the paper "Energy Conservation Techniques for Disk Array-Based Servers".
% Storage capacity: 9.17 GBytes; 
% High to low speed transition energy: 14.13 Joules; 
% High to low speed trnasition time: 5.62 seconds; 
% Low to high speed transition energy: 32.96 Joules; 
% Low to high speed transition time: 3.06 seconds; 
% Transfer rate at high speed: 31 MBytes/sec; 
% Idle power at high speed: 5.26 Watts; 
% Active energy at high speed (8-KB read): 61 mJoules; 
% Transfer rate at low speed: 9.3 MBytes/sec; 
% Idle power at low speed: 2.17 Watts; 
% Active energy at low speed (8-KB read): 43 mJoules
% Note that one watt is one joule per second!!!!
High_idle_power=5.26;  %% Watts
High_transfer_rate=31; %% Kbytes/sec;
High_read_energy=0.061; %% Note that the unit is Joule. Each read operation consumes 61 mJoules for reading 8KB data.
Read_unit=0.008;        %% Note that the unit is Mbyte. Each read operation will transfer 8 KBytes data and consumes 61 mJoules.
% At any given time, a disk can be in one of the following 6 states:
% 1. Transfer (read) at high speed; 2. Idle at high speed; 3. Transition from high speed to low speed; 4. Transfer (read) at low speed; 5. Idle at low speed; 6. Transition from low speed to high speed.
% However, in this research project, I do NOT consider speed transition for the following 3 reasons: 1. Speed transition is very costly in terms of
% energy consumption and response time; 2. Speed transition noticeably affect the reliability of disk; 3. Speed transition makes my algorithm SEAD complicated. 
% Instead, my strategy is: Based on the file popularity, assigne all popular files on a small set of disk array and keep them in
% high speed all the time. Assign cold files on the rest disks and keep
% them in low speed all the time. The advantages of my strategy are: 1. There is no speed transitions; 2. The algorithm is simple and cheap; 3. The number of hot disks in a disk array 
% can be dynamically adjusted if the number of hot files increases. In other words, the percentage of the number of hot disks in a disk array is configurable and it is decided by the workload.
% Therefore, for each disk, we need to decide its speed status based on its load. There are only two options: either the disk is in the high speed all the time or it is in the low speed all the time.
% Note that dividing disks into hot and cold categories are only adopted by my SEAD algorith. For Greedy, SP, and HP, they all only use high speed.

% The followings are important data structures for calculating mean response time and overall energy consumption.
% 1. For each disk, we need to record its total energy consumption during the request process. (from the time 0 to the finish time of the last request)
Disk_energy_consumption=repmat(0,1,DISK_NUM);
% 2. For each request, we need to record its execution start time. Note that a request's execution start time might be different from its arrival time.
Request_start_time=repmat(0,1,REQUEST_NUM);
% 3. For each request, we need to record its finish time. (its response time=its finish time - its arrival time)
Request_finish_time=repmat(0,1,REQUEST_NUM);
% 4. For each request, we need to record its response time. (its response time=its finish time - its arrival time)
Request_response_time=repmat(0,1,REQUEST_NUM);
% 5. For each disk, it could be in high speed or in low speed. 1 -- High speed; 0 -- Low speed. Assume that all disks are in their high speed originally. This is true for Greedy, SP, HP.
Disk_speed_status=repmat(1,1,DISK_NUM);
% 6. For each disk, it has an available time. Each disk's available time is set to zero initially.
Disk_available=repmat(0,1,DISK_NUM);
% 7. For each disk, we need to record its total service time during the logic time span. This array is used to compute the disk utilization including mean and standard deviation.
Disk_service_time=repmat(0,1,DISK_NUM);
% 8. For each request, we need to record its slowdown. This array is used to compute the slowdown ratio.
Request_slowdown=repmat(0,1,REQUEST_NUM);

i=1;
idle_num=1;
while i <= REQUEST_NUM
    % Find the disk number on which the current file was assigned.
    current_file=Request_attribute(i,1);
    current_disk=file_disk(Request_attribute(i,1));
    current_request_arrival_time=Request_attribute(i,2);
    idle_time=current_request_arrival_time-Disk_available(current_disk);
    if idle_time > 0
        Disk_energy_consumption(current_disk)=Disk_energy_consumption(current_disk)+idle_time*High_idle_power; %% calculate the idle energy consumption;
        Request_start_time(i)=current_request_arrival_time; %% In this case, this request's execution time is equal to its arrival time.
        Disk_idle(idle_num,1)=current_disk;                        %% Record the current disk ID
        Disk_idle(idle_num,2)=Disk_available(current_disk);        %% Record the idle starting time on the current disk.
        Disk_idle(idle_num,3)=current_request_arrival_time;        %% Record the idle finishing time on the current disk.
        idle_num=idle_num+1;
    else
        Request_start_time(i)=Disk_available(current_disk); %% In this case, this request's execution time is equal to its disk's available time.
    end
    current_request_service_time=File_size(current_file)/High_transfer_rate; %% The time needed to serve the current request.
    current_request_energy=(File_size(current_file)/Read_unit)*High_read_energy;     %% The energy consumption for serving the current request.
    Disk_energy_consumption(current_disk)=Disk_energy_consumption(current_disk)+current_request_energy; %% Update the total energy consumed so far for the current disk.
    Disk_service_time(current_disk)=Disk_service_time(current_disk)+current_request_service_time;  %% Update the disk's service time so far.
    Request_finish_time(i)=Request_start_time(i)+current_request_service_time;%% The finish time of the current request.
    Disk_available(current_disk)=Request_finish_time(i);                      %% Update the current disk's available time.
    Request_response_time(i)=Request_finish_time(i)-current_request_arrival_time; %% Compute current request's response time.
    Request_slowdown(i)=Request_response_time(i)/current_request_service_time;    %% Compute current request's slowdown.
    i=i+1;
end
% For disks who have been idle between its last request's finish time and
% the logical_finish_time, we need to include their idle energy
% consumption. Because we want to compute overall disk energy consumption
% during the time span (logical_finish_time - logical_start_time).
Disk_utilization=repmat(0,1,DISK_NUM);  %% Record each disk's utilization.
real_Disk_utilization=repmat(0,1,DISK_NUM);  %% Record each disk's utilization.
%logical_finish_time=max(Request_finish_time);
i=1;
while i <= DISK_NUM
    %idle_time=logical_finish_time-Disk_available(i);
    %if idle_time > 0
        % Disk_energy_consumption(i)=Disk_energy_consumption(i)+idle_time*High_idle_power;
    %end
    %Disk_utilization(i)=Disk_service_time(i)/logical_finish_time;
    real_Disk_utilization(i)=Disk_service_time(i)/Disk_available(i);
    i=i+1;
end
greedy_disk_utilization=Disk_utilization;
real_greedy_disk_utilization=real_Disk_utilization;

Total_energy_consumption=sum(Disk_energy_consumption);
Mean_response_time=mean(Request_response_time);
xx=0;
Performance_matrix(1,1)=Mean_response_time;
Performance_matrix(1,2)=std(disk_load); %% the standard deviation of disk heat (load).
Performance_matrix(1,3)=mean(real_Disk_utilization);
Performance_matrix(1,4)=std(real_Disk_utilization,1);
Performance_matrix(1,5)=std(Disk_energy_consumption,1);
Performance_matrix(1,6)=mean(Request_slowdown);
%%%%%%%%%% End of the Greedy file allocation algorithm implementation %%%%%%%%%% 

%%%%%%%%%% Beginning of the SP file allocation algorithm implementation %%%%%%%%%% 
% Step 1: Compute the average disk utilization Ave_utilization=1/DISK_NUM* total amount of all the FILE_NUM files' heats;
% Ave_utilization=sum(File_heat)/DISK_NUM;
[Y,I] = sort(File_size,2,'ascend');  %% I is a sorted array that contains the ID of the FILE_NUM files in ascending order in terms of their sizes. Since a file's service time
%  is propotional to its size, I just sort the file list accoring to their sizes.
%  Step 2: Allocate to each disk dj the next contiguous segment of I until its load, loadj, reaches the maximum allowed level Ave_uitlization;
disk_load=repmat(0,1,DISK_NUM);
file_disk=repmat(0,1,FILE_NUM); %% This array is used to record: for each file, which disk it is assigned onto.
I_disk=repmat(0,DISK_NUM,FILE_NUM); 
i=1;
k=1;
for j = 1:DISK_NUM
    current_load=disk_load(j); 
    k=1;
    next_load=current_load+File_heat(I(i));
    while (next_load <= Real_Ave_utilization) && (i <= FILE_NUM)
        I_disk(j,k)=I(i);
        file_disk(I(i))=j;
        current_load=next_load;
        i=i+1;
        next_load=current_load+File_heat(I(i)); 
        k=k+1;
    end
    disk_load(j)=current_load;
end
%% heat_left=0; for debug
if (i <= FILE_NUM) 
    while i <= FILE_NUM
        I_disk(DISK_NUM,k)=I(i);
        file_disk(I(i))=DISK_NUM;        
        disk_load(DISK_NUM)=disk_load(DISK_NUM)+File_heat(I(i));        
        k=k+1;
        i=i+1;
%% heat_left=heat_left+File_heat(I(i)); for debug
    end
end

% For each disk, calculate its request arrival queue.
disk_request_queue=repmat(0,DISK_NUM,round(REQUEST_NUM/2));
i=1;
while i <= DISK_NUM
    j=1;
    k=1;
    while j <= REQUEST_NUM
        temp_current_file=Request_attribute(j,1);
        if i == file_disk(temp_current_file)
            disk_request_queue(i,k)=Request_attribute(j,2);
            k=k+1;
        end
        j=j+1;
    end
    i=i+1;
end
xx=1;    
save sp_disk_request_q disk_request_queue;

% Step 3: Calculate mean response time and overall energy consumption for the SP algorithm. I re-declare the following data structures so that the old ones for Greedy algorithm couldn't affect SP.
% The followings are important data structures for calculating mean response time and overall energy consumption.
% 1. For each disk, we need to record its total energy consumption during the request process. (from the time 0 to the finish time of the last request)
Disk_energy_consumption=repmat(0,1,DISK_NUM);
% 2. For each request, we need to record its execution start time. Note that a request's execution start time might be different from its arrival time.
Request_start_time=repmat(0,1,REQUEST_NUM);
% 3. For each request, we need to record its finish time. (its response time=its finish time - its arrival time)
Request_finish_time=repmat(0,1,REQUEST_NUM);
% 4. For each request, we need to record its response time. (its response time=its finish time - its arrival time)
Request_response_time=repmat(0,1,REQUEST_NUM);
% 5. For each disk, it could be in high speed or in low speed. 1 -- High speed; 0 -- Low speed. Assume that all disks are in their high speed originally. This is true for Greedy, SP, HP.
Disk_speed_status=repmat(1,1,DISK_NUM);
% 6. For each disk, record all of its idle time slots.
Disk_idle=repmat(0,DISK_NUM,round(REQUEST_NUM/2));
% 7. For each disk, it has an available time. Each disk's available time is set to zero initially.
Disk_available=repmat(0,1,DISK_NUM);
% 8. For each disk, we need to record its total service time during the logic time span. This array is used to compute the disk utilization including mean and standard deviation.
Disk_service_time=repmat(0,1,DISK_NUM);
% 9. For each request, we need to record its slowdown. This array is used to compute the slowdown ratio.
Request_slowdown=repmat(0,1,REQUEST_NUM);
% 10. Record the current position for each disk for caculating its idle time slots.
disk_available_position=repmat(1,1,DISK_NUM); % This array is used to record the currently available position for next incoming file to be assigned on a disk. Initialy, it is 1 as no files was assign onto a disk yet. This array is only used by HP.
i=1;
while i <= REQUEST_NUM
    % Find the disk number on which the current file was assigned.
    current_file=Request_attribute(i,1);
    current_disk=file_disk(Request_attribute(i,1));
    current_request_arrival_time=Request_attribute(i,2);
    idle_time=current_request_arrival_time-Disk_available(current_disk);
    if idle_time > 0
        Disk_energy_consumption(current_disk)=Disk_energy_consumption(current_disk)+idle_time*High_idle_power; %% calculate the idle energy consumption;
        Request_start_time(i)=current_request_arrival_time; %% In this case, this request's execution time is equal to its arrival time.
    else
        Request_start_time(i)=Disk_available(current_disk); %% In this case, this request's execution time is equal to its disk's available time.
    end
    if idle_time > 0
        Disk_idle(current_disk,disk_available_position(current_disk))=idle_time;
    else
        Disk_idle(current_disk,disk_available_position(current_disk))=0;
    end
    disk_available_position(current_disk)=disk_available_position(current_disk)+1;
    current_request_service_time=File_size(current_file)/High_transfer_rate; %% The time needed to serve the current request.
    current_request_energy=(File_size(current_file)/Read_unit)*High_read_energy;     %% The energy consumption for serving the current request.
    Disk_energy_consumption(current_disk)=Disk_energy_consumption(current_disk)+current_request_energy; %% Update the total energy consumed so far for the current disk.
    Disk_service_time(current_disk)=Disk_service_time(current_disk)+current_request_service_time;  %% Update the disk's service time so far.
    Request_finish_time(i)=Request_start_time(i)+current_request_service_time;%% The finish time of the current request.
    Disk_available(current_disk)=Request_finish_time(i);                      %% Update the current disk's available time.
    Request_response_time(i)=Request_finish_time(i)-current_request_arrival_time; %% Compute current request's response time.
    Request_slowdown(i)=Request_response_time(i)/current_request_service_time;    %% Compute current request's slowdown.
    i=i+1;
end
% For disks who have been idle between its last request's finish time and
% the logical_finish_time, we need to include their idle energy
% consumption. Because we want to compute overall disk energy consumption
% during the time span (logical_finish_time - logical_start_time).
Disk_utilization=repmat(0,1,DISK_NUM);  %% Record each disk's utilization.
real_Disk_utilization=repmat(0,1,DISK_NUM);  %% Record each disk's utilization.
%logical_finish_time=max(Request_finish_time);
i=1;
while i <= DISK_NUM
    %idle_time=logical_finish_time-Disk_available(i);
    %if idle_time > 0
    %    Disk_energy_consumption(i)=Disk_energy_consumption(i)+idle_time*High_idle_power;
    %end
    %Disk_utilization(i)=Disk_service_time(i)/logical_finish_time;
real_Disk_utilization(i)=Disk_service_time(i)/Disk_available(i);
i=i+1;
end
sp_disk_utilization=Disk_utilization;
real_sp_disk_utilization=real_Disk_utilization;
Total_energy_consumption=sum(Disk_energy_consumption);
Mean_response_time=mean(Request_response_time);
Performance_matrix(2,1)=Mean_response_time;
Performance_matrix(2,2)=std(disk_load);
Performance_matrix(2,3)=mean(real_Disk_utilization);
Performance_matrix(2,4)=std(real_Disk_utilization,1);
Performance_matrix(2,5)=std(Disk_energy_consumption,1);
Performance_matrix(2,6)=mean(Request_slowdown);


%%%%%%%%%% End of the SP file allocation algorithm implementation %%%%%%%%%% 


% skew_80 means that in the sead_trace_generator.m we set the SKEW_DEGREE
% to 0.8 and the distribution of file size is Zipf's law.
% algorithm_5 means that we evaluate the 5 algorithms and put the data in the Performance_matrix maxtrix.
% FILE_NUM=5000;         %% Number of files to be assigned to the disk array.
% REQUEST_NUM=100000;    %% Total number of requests.
% TIME_SPAN=3000;       %% This is the time span in which the REQUEST_NUM access requests arrived in the server. The unit is second.
% normall00_100  means that the normal distribution uses mean=100 and
% deviation=100; expo100 means that using exponential distribution with mean=100
save performance_skew70file50request1000timespan50disk16 Performance_matrix;
xx=1;
