How do I execute my file so it does one of 2 algorithms? such as ./file SPN??


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How do I execute my file so it does one of 2 algorithms? such as ./file SPN??
Prev   Next
# 1  
Old 12-11-2011
How do I execute my file so it does one of 2 algorithms? such as ./file SPN??

Hi

I completed a project for school where we had to do cpu scheduling by reading in a file processes.txt and then doing 2 algorithms on it and printing out the order in which processes execute (current time to current process executing) and then doing some calculations (turn around time, etc.).

This is the part that confuses me:

your program should allow you to specify the abbreviation of the algorithm you wish to execute on the command line (see below for abbreviations).

I have one big file that does both of my algorithms at once and prints out their results one after the other. If I wanted to have it so my script executes one or the other, how do I go about this? for instance ./file SPN (to execute shortest process next algorithm) how would I do this? My entire code for both was written into the END{} portion in awk. Would I have to modify the entire thing?

pls keep in mind im still a newbie at this

Pls help!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check file creation Time minutes and if file older then 5 minutes execute some stuff

Hello all, Info: System RedHat 7.5 I need to create a script that based on the creation time, if the file is older then 5 minutes then execute some stuff, if not exit. I thought to get the creation time and minutes like this. CreationTime=$(stat -c %y /tmp/test.log | awk -F" " '{ print... (3 Replies)
Discussion started by: charli1
3 Replies

2. Shell Programming and Scripting

Find a file and if exists , execute a different file

Good Morning All, I'm a novice and please excuse me if i did miss some of the forum rules. What my intention is, i have a file (services) residing @ /u01/Oracle/services. I know i can use the find command to find the "service" file. I get this file from a windows box and there is no certain... (8 Replies)
Discussion started by: thinkingeye
8 Replies

3. Fedora

Cannot execute binary file

Hi all, Probably somewhat of an obvous problem here but i'm no pro. I just bought a PengPod1000 at pengpod.com On it I have an image of Fedora 18. I am trying to run an application I wrote for Fedora 14 32 bit desktop on this tablet. With all permissions setup using chmod but I get... (7 Replies)
Discussion started by: fedora18
7 Replies

4. UNIX for Dummies Questions & Answers

File cannot execute

Hi everyone, I'm trying to run a plotting tool called gnuplot. So there is a /import/tools/exe directory which has a 'gnuplot' file and a '.gnu_tool_wrapper' file. When I type 'gnuplot' in this directory, it's supposed to go through the wrapper and run... (10 Replies)
Discussion started by: coldler
10 Replies

5. Web Development

Cannot execute sh file using button click in php file in apache

I the problem that i facing is cannot use button click to execute the sh file that store in the same location. the program file is a php file and running in apache2. the code that i run is show below <button onclick="sh()" name="sh">SH</button> <script type='text/javascript'> function sh()... (5 Replies)
Discussion started by: zhengkoon8
5 Replies

6. Shell Programming and Scripting

find specific file names and execute a command depending on file's name

Hi, As a newbie, I'm desperate ro make my shell script work. I'd like a script which checks all the files in a directory, check the file name, if the file name ends with "extracted", store it in a variable, if it has a suffix of ".roi" stores in another variable. I'm going to use these two... (3 Replies)
Discussion started by: armando110
3 Replies

7. Linux

cannot execute binary file

We are getting one error when we execute the binary file below mentioned, and ownership goes to root:nobody, how to resolve this problem. sh /home/pub/bin/awk: cannot execute binary file :confused: Pls help me out . (2 Replies)
Discussion started by: durgaprasadr13
2 Replies

8. Shell Programming and Scripting

Execute .sh file with sudo in it

Hi, I logged into a UNIX system as user ABC. I do not have root previleges and also do not have root password. I am executing few commands as: ABC****>sudo su - XYZ XYZ****>rm file1.txt XYZ****>exit ABC****> Now I want to execute all these commands from a .sh file ( or in any other... (2 Replies)
Discussion started by: _prasad
2 Replies

9. Shell Programming and Scripting

Need to execute 2 scripts, wait, execute 2 more wait, till end of file

:cool: I need to execute a shell script to do the following: cat a file run two back ground processes using the first two values from the file wait till those background processes finish run two more background processes using the next two values from the file wait till those background... (1 Reply)
Discussion started by: halo98
1 Replies
Login or Register to Ask a Question
FSS(7)							   Device and Network Interfaces						    FSS(7)

NAME
FSS - Fair share scheduler DESCRIPTION
The fair share scheduler (FSS) guarantees application performance by explicitly allocating shares of CPU resources to projects. A share indicates a project's entitlement to available CPU resources. Because shares are meaningful only in comparison with other project's shares, the absolute quantity of shares is not important. Any number that is in proportion with the desired CPU entitlement can be used. The goals of the FSS scheduler differ from the traditional time-sharing scheduling class (TS). In addition to scheduling individual LWPs, the FSS scheduler schedules projects against each other, making it impossible for any project to acquire more CPU cycles simply by running more processes concurrently. A project's entitlement is individually calculated by FSS independently for each processor set if the project contains processes bound to them. If a project is running on more than one processor set, it can have different entitlements on every set. A project's entitlement is defined as a ratio between the number of shares given to a project and the sum of shares of all active projects running on the same proces- sor set. An active project is one that has at least one running or runnable process. Entitlements are recomputed whenever any project becomes active or inactive, or whenever the number of shares is changed. Processor sets represent virtual machines in the FSS scheduling class and processes are scheduled independently in each processor set. That is, processes compete with each other only if they are running on the same processor set. When a processor set is destroyed, all processes that were bound to it are moved to the default processor set, which always exists. Empty processor sets (that is, sets without processors in them) have no impact on the FSS scheduler behavior. If a processor set contains a mix of TS/IA and FSS processes, the fairness of the FSS scheduling class can be compromised because these classes use the same range of priorities. Fairness is most significantly affected if processes running in the TS scheduling class are CPU- intensive and are bound to processors within the processor set. As a result, you should avoid having processes from TS/IA and FSS classes share the same processor set. RT and FSS processes use disjoint priority ranges and therefore can share processor sets. As projects execute, their CPU usage is accumulated over time. The FSS scheduler periodically decays CPU usages of every project by multi- plying it with a decay factor, ensuring that more recent CPU usage has greater weight when taken into account for scheduling. The FSS scheduler continually adjusts priorities of all processes to make each project's relative CPU usage converge with its entitlement. While FSS is designed to fairly allocate cycles over a long-term time period, it is possible that projects will not receive their allocated shares worth of CPU cycles due to uneven demand. This makes one-shot, instantaneous analysis of FSS performance data unreliable. Note that share is not the same as utilization. A project may be allocated 50% of the system, although on the average, it uses just 20%. Shares serve to cap a project's CPU usage only when there is competition from other projects running on the same processor set. When there is no competition, utilization may be larger than entitlement based on shares. Allocating a small share to a busy project slows it down but does not prevent it from completing its work if the system is not saturated. The configuration of CPU shares is managed by the name server as a property of the project(4) database. In the following example, an entry in the /etc/project file sets the number of shares for project "x-files" to 10: x-files:100::::project.cpu-shares=(privileged,10,none) Projects with undefined number of shares are given one share each. This means that such projects are treated with equal importance. Projects with 0 shares only run when there are no projects with non-zero shares competing for the same processor set. The maximum number of shares that can be assigned to one project is 65535. You can use the prctl(1) command to determine the current share assignment for a given project: $ prctl -n project.cpu-shares -i project x-files or to change the amount of shares if you have root privileges: # prctl -r -n project.cpu-shares -v 5 -i project x-files See the prctl(1) man page for additional information on how to modify and examine resource controls associated with active processes, tasks, or projects on the system. See resource_controls(5) for a description of the resource controls supported in the current release of the Solaris operating system. By default, project "system" (project ID 0) includes all system daemons started by initialization scripts and has an "unlimited" amount of shares. That is, it is always scheduled first no matter how many shares are given to other projects. The following command sets FSS as the default scheduler for the system: # dispadmin -d FSS This change will take effect on the next reboot. Alternatively, you can move processes from the time-share scheduling class (as well as the special case of init) into the FSS class without changing your default scheduling class and rebooting by becoming root, and then using the priocntl(1) command, as shown in the following example: # priocntl -s -c FSS -i class TS # priocntl -s -c FSS -i pid 1 CONFIGURING SCHEDULER WITH DISPADMIN
You can use the dispadmin(1M) command to examine and "tune" the FSS scheduler's time quantum value. Time quantum is the amount of time that a thread is allowed to run before it must relinquish the processor. The following example dumps the current time quantum for the fair share scheduler: $ dispadmin -g -c FSS # # Fair Share Scheduler Configuration # RES=1000 # # Time Quantum # QUANTUM=110 The value of the QUANTUM represents some fraction of a second with the fractional value determied by the reciprocal value of RES. With the default value of RES = 1000, the reciprocal of 1000 is .001, or milliseconds. Thus, by default, the QUANTUM value represents the time quan- tum in milliseconds. If you change the RES value using dispadmin with the -r option, you also change the QUANTUM value. For example, instead of quantum of 110 with RES of 1000, a quantum of 11 with a RES of 100 results. The fractional unit is different while the amount of time is the same. You can use the -s option to change the time quantum value. Note that such changes are not preserved across reboot. Please refer to the dispadmin(1M) man page for additional information. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |Architecture |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
prctl(1), priocntl(1), dispadmin(1M), psrset(1M), priocntl(2), project(4), attributes(5), resource_controls(5) System Administration Guide: N1 Grid Containers, Resource Management, and Solaris Zones SunOS 5.10 1 Oct 2004 FSS(7)