if a bank is short reserves at the end of the day or at the end of some accounting period, it will attempt to borrow them in the overnight fed funds market, from other banks. if the whole system is short reserves, they will bid the rate above the Fed's target rate. let's say the Fed's target for the federal funds rate is 5%. they will bid it up to 5.5 or 6. The Fed will provide reserves by purchasing treasuries from the banks. these are called open market operations. they use them to hit the target rate. this would generally happen before banks rushed to the discount window, unless the fed stopped supporting the target rate. what that would actually mean in practice is that the Fed would be abandoning its own policy of setting the rate. if they chose to adopt a policy of fixing the supply of reserves, and letting the interest rate float, that would be closer to a free market approach. but then the Fed would be giving up its role as "securer" of the payments system, and if there was a run on deposits, banks would have to liquidate assets at the market price to raise cash to meet the reserve requirements. or depositors might not be able to get cash.