Sponsored Content
Full Discussion: Banker's algorithm
Homework and Emergencies Homework & Coursework Questions Banker's algorithm Post 302630623 by Scrutinizer on Thursday 26th of April 2012 05:24:07 AM
Old 04-26-2012
First thing that comes to mind is emulation using eval*

Code:
for (( i=1; i<=5 ; i++ ))
do
  for (( j=1; j<=5 ; j++ ))
  do
    eval a_${i}_[$j]=$(( i + j*10 ))
  done
done

echo "${a_3_[4]}"

k=3 l=4
eval echo "\"\${a_${k}_[l]}\""

eval "val=\${a_${k}_[l]}"
echo "$val"

Did you look for alternatives?

--
*In general be extra careful with eval, always look for security risks if variable content comes from a source that you do not control.

Last edited by Scrutinizer; 04-26-2012 at 06:50 AM..
 

6 More Discussions You Might Find Interesting

1. Programming

Feedback algorithm

Hi I search an exemple of scheduling Feedback algorithm, or help about how to create one. Thanks (0 Replies)
Discussion started by: messier79
0 Replies

2. Shell Programming and Scripting

algorithm

PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP 21444 tomusr 213M 61M sleep 29 10 1:20:46 0.1% java/43 21249 root 93M 44M sleep 29 10 1:07:19 0.2% java/56 is there anyway i can use a command to get the total of the SIZE? 306M (Derive from... (5 Replies)
Discussion started by: filthymonk
5 Replies

3. Programming

Please help me to develop algorithm

Hi guys , in my study book from which I re-learn C is task to generate all possible characters combination from numbers entered by the user. I know this algorithm must use combinatorics to calculate all permutations. Problem is how to implement algortihm. // This program reads the four numbers... (0 Replies)
Discussion started by: solaris_user
0 Replies

4. Programming

Looking for Your Help on dijkstra algorithm

Can you help to adjust the void dijkstra(int s) function to find a path from source to every node so that the minimum cost on that path is maximum. Ex: From 1 to 2 we have 1 - 3 - 4 - 2 , costs(2+3+4+5) From 1 to 2 we have 1 - 5 - 6 - 2 , costs(3+3+4+5) I need the algorithm to choose path 1... (4 Replies)
Discussion started by: ali2011
4 Replies

5. Homework & Coursework Questions

Heuristic Algorithm Example

Give a counter example such that the following heuristic algorithm, for the 2-tape problem, doesn't always produce the best solution: Algorithm: Sort {Xi} in descending order. Place files in tapes one at a time. For a file being considered, assign the file to the smaller tape. Thanks in... (1 Reply)
Discussion started by: sureshcisco
1 Replies

6. UNIX for Dummies Questions & Answers

banker's algorithm.. help

i'm doing banker's algorithm.. got some error there but i cant fix it.. please help!! #!/bin/bash echo "enter no.of resources: " read n1 echo -n "enter the max no .of resources for each type: " for(( i=0; i <$n1; i++ )) do read ${t} done echo -n "enter no .of... (1 Reply)
Discussion started by: syah
1 Replies
OSSAUDIO(3)						   BSD Library Functions Manual 					       OSSAUDIO(3)

NAME
ossaudio -- OSS audio emulation LIBRARY
OSS Audio Emulation Library (libossaudio, -lossaudio) SYNOPSIS
#include <soundcard.h> DESCRIPTION
The ossaudio library provides an emulation of the OSS (Linux) audio interface. Use the native interface for new programs and the emulation library only for porting programs. Mixer Control Map The following table summarizes the mappings from native interface device names to OSS mixer controls. Native Device Name OSS Mixer Control *.mic SOUND_MIXER_MIC *.line SOUND_MIXER_LINE *.cd SOUND_MIXER_CD *.dac SOUND_MIXER_PCM *.aux SOUND_MIXER_LINE1 *.record SOUND_MIXER_IMIX *.master SOUND_MIXER_VOLUME *.treble SOUND_MIXER_TREBLE *.bass SOUND_MIXER_BASS *.speaker SOUND_MIXER_SPEAKER *.output SOUND_MIXER_OGAIN *.input SOUND_MIXER_IGAIN *.fmsynth SOUND_MIXER_SYNTH *.midi SOUND_MIXER_SYNTH SEE ALSO
audio(4), midi(4) HISTORY
The ossaudio library first appeared in NetBSD 1.3. BUGS
The emulation uses a #define for ioctl() so some obscure programs can fail to compile. The emulation is incomplete. The emulation only covers ioctl(), there are other differences as well. E.g., on a write that would block in non-blocking mode Linux returns EINTR whereas NetBSD 1.3 returns EAGAIN. BSD
February 3, 2009 BSD
All times are GMT -4. The time now is 08:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy