Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this question, you will formalize requirements about yet another high - performance computing centre. The high - performance computing centre consists of a group
In this question, you will formalize requirements about yet another highperformance computing centre.
The highperformance computing centre consists of a group of CPUs. Different CPUs may have different amounts
of memory and provide different levels of security.
Each program has a minimum security level and a minimum amount of memory that it needs to run on a CPU.
Allocation is the process of assigning programs to the CPU that they will run on An allocation is a set of
prog cpu pairs indicating which CPU each program will run on
Given the environment:
Type cpu CPUs
Type prog programs
Type mem : N amount of memory
Type seclvl : N security level
Type alloc : setprog cpu allocation
to memc : cpu : N the total amount of memory on the CPU
to memp : prog : N the memory required by the program
to secc : cpu : seclvl the security level provided by the CPU
to secp : prog : seclvl the security level required by the program
Notes:
The functions to mem and to sec are overloaded to work on both CPUs and programs.
All programs are unique. You do not need to worry about supporting two copies of the same program.
All CPUs are unique.
Qa Formalization marks
Formalize the requirement below as a predicate mem ok that takes an allocation as an argument and deter
mines whether the allocation satisfies the requirement.
Requirement: The total amount of memory required by all of the programs allocated in A to any CPU is
less than the total amount of memory on the CPU.
Formalize the requirement below as a predicate is optimal that takes an allocation as an argument and deter
mines whether the allocation satisfies the requirement.
The formalization of is optimal may use functions that you defined as part of the first requirement.
Requirement: For any program allocated in A to any CPU, there is not another CPU with a lower security
level that could be allocated to the program, where could be allocated means that CPUs security level is at
least as high as that required by the program and the CPU has sufficient unused memory for the program to
run.
Qb Code review marks
The two functions below, addalloc and addalloc are intended to allocate a program to a CPU and satisfy the
requirements above.
Your task is to determine if each function behaves as intended.
Notes:
Assume that there is at least one CPU in A that could be allocated to p That is you do not have to worry
about errors or failures in allocation.
Assume that all values of type cpu are in A
If a function does not behave as intended, describe the unintended behaviour and explain why the code causes
the function to have the behaviour you describe. egthe function always returns the empty set, because it
tests if CompEng students have a life in the real world, which is always false.
If a function behaves as intended, give a brief brief informal justification.
add allocp : prog, A : alloc : alloc :
val A : alloc p c p in to progsAcup p c in to cpusA
p cp c in Ap c in A could allocp c A is optimalA
add allocp : prog, A : alloc : alloc :p c p : prog, c : cpu p c in A mem okA cup p c is optimalA cup p cp p
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started