Last active
September 21, 2017 16:11
-
-
Save mannuscript/16b500bf9bc3bce1cf0fcf40f877b579 to your computer and use it in GitHub Desktop.
Given load (in erlang) and blocking probability, this script calculates the number of servers required.
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> | |
using namespace std; | |
int getServersCount(float prob, float load) | |
{ | |
long double B = 1.0; | |
int m = 1; | |
while(true) { | |
B = 1 + B*m/load; | |
if(B >= 1/prob) | |
return m; | |
m++; | |
} | |
} | |
int main(void) | |
{ | |
float prob = .02, load=3000; | |
cout<<"Enter the value of probability and load respectively: "; | |
cin>>prob>>load; | |
cout<<"Number of servers required are: "<<getServersCount(prob, load)<<endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment