First Come First Serve Process scheduling using python

process = []
total_waiting_time = 0
n = int(raw_input('Enter the total no of processes: '))
for i in xrange(n):
    process.append([])
    process[i].append(raw_input('Enter process name: '))
    process[i].append(int(raw_input('Enter process arrival time : ')))
    total_waiting_time += process[i][1]
    process[i].append(int(raw_input('Enter process  burst time: ')))
    print ''

process.sort(key = lambda process:process[1])

print 'Process Name\tArrival Time\tBurst Time'
for i in xrange(n):
    print process[i][0],'\t\t',process[i][1],'\t\t',process[i][2]
   
print 'Total waiting time: ',  total_waiting_time
print 'Average waiting time: ',(total_waiting_time/n)

9 comments:

MS Azure Training in Hyderabad said...

This concept is a good way to enhance the knowledge.thanks for sharing..
Python Flask Training
Flask Framework
Python Flask Online Training

MS Dynamics said...

Thanks for sharing this blog.This article gives lot of information.
Python Training in Hyderabad

Python Training

Python Online Training

high technologies solutions said...

very useful content shared by you.Thanks for the posting
Python training course in Delhi
python training institute in noida

rajani said...

It is very helpful and very interesting and informative Blog...
Django Online Courses
Django Training in Hyderabad
Python Django Online Training
Python Django Training in Hyderabad

Prwatech said...

I am happy for sharing on this blog its awesome blog I really impressed. thanks for sharing. Great efforts.

Looking for Big Data Hadoop Training Institute in Bangalore, India. Prwatech is the best one to offers computer training courses including IT software course in Bangalore, India.

Also it provides placement assistance service in Bangalore for IT. big data certification courses in bangalore.

Blog27999 said...
This comment has been removed by a blog administrator.
Unknown said...

python online Evantatech provides you the best python online training with practical oriented course with the help of real time faculty.

Ananya said...

Nice post. Thanks for sharing.
Machine Learning training in Pallikranai Chennai
Pytorch training in Pallikaranai chennai
Data science training in Pallikaranai
Python Training in Pallikaranai chennai
Deep learning with Pytorch training in Pallikaranai chennai
Bigdata training in Pallikaranai chennai
Mongodb Nosql training in Pallikaranai chennai
Spark with ML training in Pallikaranai chennai
Data science Python training in Pallikaranai
Bigdata Spark training in Pallikaranai chennai
Sql for data science training in Pallikaranai chennai
Sql for data analytics training in Pallikaranai chennai
Sql with ML training in Pallikaranai chennai

James Williams said...

Nice Blog, Thanks for sharing the such a great information.
Python Online Training
Python Online Training in Chennai
Python Online Course in Chennai
Python Online Course