Programming :: Simulate Dijsktra's Algorithm Using Network Animator Of Ns2?
May 3, 2011
I need to simulate dijsktra's algorithm using network animator of ns2. how to write a tcl script for my code. This tcl script runs the dijsktra code and simulates its running on network animator.
I want to simulate a serial protocol in user space program to test reception algorithm. The protocol is similar to UART protocol but frame format is different. The duration of 1 bit is 114,46 us. In my main function I'm creating two threads. Tx for simulating transmitting data and Rx for reception data. For measure time I use create_timer() function and signals. Each thread has its own timer and signal handler. Tx timer uses SIGUSR1 and Rx timer uses SIGUSR2. Tx thread sets the global variable and Rx reads it.
The timers are set to sample with 114,46 us period. When they reach this value signal handler should set the flag. Flag is check in thread and some operation are made. When I set the timers period for longer time (100 ms) everything works fine but when I change it to default value (114,46 us) the Rx thread doesn't receive the proper data. I am wondering if the 114,46 timer period is possible to simulate in user space? Whether the time will give me the proper resolution ? Theoretically it should provide 1 ns resolution.
I have a copy of the MD5 algorithm and I'm taking a look at the source. It's pretty interesting but there are a few things that I'm curious about and I was wondering if anyone a bit more intuitive than I could help me out.The function declarations in the MD5 files are a bit unfamiliar to me. There is a macro used called PROTO_LIST, which I'm still not sure as to what this thing is doing exactly, but it's littered everywhere throughout the source.The signature here isn't too unfamiliar to me with the exception of the position of the PROTO_LIST macro. So here is a function with an unnamed argument of type MD5_CTX*.To me, this resembles an initializer list found in C++ with constructors but I certainly don't think that is the case here. So my questions about this are (1) how is this legal code in C and (2) what functionality has the PROTO_LIST macro provided for the function?
I'm trying to save the output of the script I wanna run but for some reason I cant manage to do it with "script.sh > Output_4.txt"
The thing is that the script was already run and it extracted some directories so when I try to run it again (to save the log to a Output_4.txt) bash says (see screen-capture) and of course the log's empty!!!!
I have a timer thread, and when it expires, it sets a flag. The only problem is, if any higher priority thread comes in between, then the timer is not expired in real time.Thus i want to set a highest priority to my thread. Now, i know 2 algos, which can make my thread in real time are: SCHED_FIFO and SCHED_RR.
So, here are my queries: 1) Which scheduling algo is best suited for this purpose? 2) Is it guaranted to work in real time if i use that algo (you suggest in 1) and set the max_priority by getting the maximum settable priority for that particular algorithm using, int sched_get_priority_max(int policy);
I've got a bit of an obscure question for you to test your brains a wee bit. I'm trying to implement a search program to find areas of high density in a binary string.
Where density is the number of 1's / number of digits with a maximum number of digits being the current number in a buffer (in this example 50). So for the example the density for the whole buffer is 15/50. But the density of Buffer[14..20]=[1110001]=4/7. So if looking for areas of density = 1/3 it would find the longest sequences of density over 1/3.So in the example. Buffer[4..9]=[100101]=3/6=1/2 which is above 1/3 but it is within the Buffer[4..48]=[100101000011100010000001000100100001001011001]=15/45=1/3
I have an algorithm guys called "Self Configurable Diagnosis Algorithm" but i don't have program for this.help me regarding that program and which type of Tcl script will be better suitable for that.
I have a program that receive user input. I want to run this program automatically without user interaction, and in order to do that I need to simulate key events. How can I do such a thing?
The program I am running is partly java and partly shell.
The shell part is easily done by using: ./prog.sh <parameters (Parameters being a file containing parameters) But the java doesn't work similarly.
AStar works on the basis of straight lines, AFAIK. In my case, we have geocoordinates and I can get the straight line distance between the waypoints. But I am wondering how approximate will the route calculated on this basis be? The actual distance "by road", which actually matters can be different.
Example. Assuming A and B are on the same plane, and will be equidistant from the goal point, if we consider a straight line between A and the goal point and, B and the goal point. The distance "by road" between A and the goal point may be greater or lesser than B. But because the AStar works on the basis of straight lines, it will return both the routes as the shortest. If yes, then which algo should be considered , if we want the results on the basis of actual distance in Km/m?
i try to understand this algorithm but i cann't. [URL] I encounter problem understand the algorithm of fixed base windowing exponentiation algorithm ? What is fixed base in the first place ? How this algorithm works ?
OpenSuSE 11.3 (but this is not likely a distro specific issue)Kernel 2.6.34.7, but likely applies to a number of previousAm close to launching a more extensive webpage describing in detail why and how this configuration is important, but I'm missing up to date information on how to persist the config. By default, changing the TCP Congestion Control algorithm only modifies the current system session. Docs I've read recommend that the command resetting the algorithm be written to Code:/etc/rc.d/rc.dAm confused with all the different config files, but I suspect either an existing file should be modified or an additional file should be modified in
algorithm:breada input: file system block number for immediate read file system block number for asynchronous read output:buffer containing data for immediate read { if(first block not in cache) { get buffer for first block if(buffer data not valid) initiate disk read } if(second block not in cache) { get buffer for second block) if(buffer data valid) //line 1 release buffer else initiate disk read //line 2 } if(first block was originally in cache) //line 3 { read first block return buffer } sleep (event first buffer contains valid data) return buffer }
Here is an algorithm for block read algorithm. I have problem in line 1: If buffer data is valid why is it releasing the buffer? line 2: If buffer data valid why is it initiating disk read. It should have read directly from buffer? line 3: It should be the first condition as if it is there in cache then it should return it without delay?
The algorithm for reading and writing disk blocks use the algorithm getblk to allocate buffers from the pool. In the algorithm getblk, if the kernel removes a buffer from the free list, it must raise the processor priority level to block out interrupts before checking the free list. Why ?Where can i find the C implementation of the above algorithm for buffer allocation in the linux source code ?
How to get rid of the following error I've been receiving from Yum. I'm fairly new to Fedora. The following message appears when Add/Remove Software is launched. It also pops up periodically in the notification window.
could not do simulate: Traceback (most recent call last): File "/usr/share/PackageKit/helpers/yum/yumBackend.py", line 3270, in __init__ self.repos.confirm_func = self._repo_gpg_confirm File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 823, in <lambda> repos = property(fget=lambda self: self._getRepos(), File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 551, in _getRepos prerepoconf = self.prerepoconf AttributeError: 'PackageKitYumBase' object has no attribute 'prerepoconf'
I wrote software which access and reads a serial device. I would like to test this software on my computer without loop-wiring or without a second computer.
How could I use pty's to simulate a serial device?
Actually I would like to temporary replace the /dev/ttyS1 file by one end of the pty. How could I do this? Is there a command to create a pty pair?
When I drink tea, the water splashed on my keyboard. It didn't cause any problems until a few mins ago. Now my Enter and right hand side shift key don't function any more (The new line in this text is copied from other thread).
So I would like to know how can I simulate an enter key press so that e.g. a command can be executed in terminal. Because I have some source code uncommitted, I want them at least get committed first.
For backup and pre-functionality purposes, I need to simulate a VirtualHost in my Fedora (14) machine. I found some interesting links to carry out that process but with an IP fix.So, how can I simulate a VH through a localhost with a dynamic IP?
I have ack-grep installed on my local machine, and find it indispensable for quickly 'acking' through a codebase when debugging. However, on my cheap shared hosting, there is no ack-grep. One of the testimonials on betterthangrep.com mentions a
Rube Goldberg mess of find/grep/xargs which sounds like what I need, but coming from the opposite direction.
I want to simulate a bad block or sector on a drive or even a virtual drive image to test my data recovery distro. I wish I would have bookmarked when I read about it before. It was some type of low level command, I remember something about scsi subsystem or kernel thingabob.
I have a G15v1. After going through hoops and loops to get it working only to discover that you only needed to install g15daemon through the Ubuntu Software Center, I found myself with one big problem. I migrated from windows just now, and there, I had my macro keys(the extra ones) bound to CTRL+W, CTRL+T and to a simulated mouse-wheel scroll so I could navigate the web more easily. How would I go about doing that? I figured, if I used the System->Preferences->Keyboard Shortcuts thingy and bound my key, in my case XF86Launch5, to a command similar to "simulate keypress CTRL+W"(I know it's totally wrong, just to give you an idea), I might be able to get it working again. Only problem is, I can't find anything like that. Any of you has any clue about it? I googled but I only find C++/Java/coding related results, which are not exactly what I need to do.