You can implement a check for the quantity that the user is choosing but it is a custom solution and will require custom coding. One way you could do this would be to have some server side validations in place that check the posted quantity against the available quantity in your db. If the entered amount exceeds the available amount then you should not add the item to the cart and display an error message to the user instead.
The second scenario you described is a little different. For this one you would need to have some temporary field in the table that holds the value that a user has added to the cart. This way when a user adds the item to the cart it would effectively reduce the available quantity so that another user would see an error when trying to add too many.
Both of these scenarios are quite custom though and are not supported features of eCart. If you have questions about the overall process I can try to give you some advice on things but I will not be able to offer in depth support of this custom solution.