Thank you Nominal Animal, you have been most helpful! :)
Type: Posts; User: Xpl0ReRChR
Thank you Nominal Animal, you have been most helpful! :)
There's struct request, which represents a request by the hard disk. The question is, how can I get info on whether the disk does a read or a write?
Your help will be much appreciated! :)
So I've edited SLOB to use the best-fit algorithm, both when finding a suitable page and a suitable block. But the question is, how do I test it? Should I just write user-level code that continuously...
It makes perfect sense, I should have tried using an example myself. Good point on the integer division!
Thank you for taking the time!
Thank you Dennis! SLOB_UNIT is defined as sizeof(slob_t), which is a struct describing a block.
I should have been more specific. What I meant to ask is, what is it that the formula represents?
#define SLOB_UNITS(size) (((size) + SLOB_UNIT - 1)/SLOB_UNIT)
Could someone explain to me what this does? I would be really greatful! :)
I have absolutely no idea what you mean.
I should have mentioned I'm using MARS, which is a MIPS simulator.
Well I'm getting the following: Runtime exception at 0x00400080: store address not aligned on word boundary 0x00000001.
typedef struct node {
int data;
struct node *next;
} nodeL;
Assuming I want to translate the above declaration in MIPS assembly language, how am I supposed to do it? Apart...
I cannot thank you enough! Indeed, my insert function wasn't correctly resetting the head pointer in that case. Insertion and printing of the nodes is now completely functioning. :) :)
clearList...
Thank you guys, I implemented your ideas and they're working great!
There's only two problems now.
1) All titles and prices are read, but
-when linked according to title, some (eg "BDD" and...
Thank you guys! Will try that loop out!
And yeah the prices are of type double, that's what's really making this hard. :/
@MK27
What the loop is trying to do, is:
- each time, check if end of file has been reached
- if it hasn't been reached, go on and scan the next title and price, then call 'insert' function to...
@twomers
Yes, but isn't there a more "clever" way of doing that? It would take like 10 switch cases of almost identical code and that would certainly not look good, even though it would work.
...
How do I make this work?
#define BOUNDARIES 10 20 30 40 50 60 70 80 90 100
index = (newnode->price == BOUNDARIES) ? (newnode->price / 10) - 1 : (int)newnode->price / 10;
Compiler says:...
It's WORKING! I used gdb and found out that I'm getting a segmentation fault at a later-on function!
Thank you anduril, MK27, stahta, vart, and CommonTater for having putting so much time and effort...
I get what you're saying and that's really helpful of you, but I don't quite understand your while(curr) and if(prev) statements.
EDIT: I got it, makes perfect sense! Though it still gets me a...
Well if prices[index] == NULL then I do prices[index] = newnode. So if curr is initialized with titles[index], it means titles[index] was not NULL, therefore I think curr can't be NULL.
And yes I...
for (prev = NULL, curr = titles[index]; (curr->nxt_title != NULL) && (strcmp(curr->title, curr->nxt_title->title) < 0); prev = curr, curr = curr->nxt_title);
This causes a segmentation fault....
typedef struct books {
char title[TITLE_LEN];
double price;
struct books *nxt_price;
struct books *nxt_title;
} booksT;
// Each line is scanned, then 'insert' is...
You're definitely right about this.
But are you sure about the use of '%'? If I'm not mistaken, 100%10=0.
Prices are of type double, and range from 0 to 100. So I figured, if a number is eg. 9.12, it corresponds to the index of 0 as it is a value less than 10. And since 9 (as an int) / 10 = 0, it would...
Yes, but for each "step" it takes, a comparison will have to be made. Therefore, I'm guessing the runner will have to contain both a temporary title and a temporary price - meaning it will have to be...
So what should I do instead? I can't think of a different way to find where the new node has to be inserted unless I do that.
Thanks to both of you by the way; I read both FAQ's and they're very...
Please do have a look at the attachment to get an idea of how it's supposed to look.
After opening a file, each line (containing <TITLE><space><PRICE><comma>) is read, and then a node is created...